4 ms·
It also wouldn't work. This just reassigns your local copy of argv[0] to a different memory location. Also, in what circumstances can argc be 0?
by ambrice 14y ago
It also wouldn't work. This just reassigns your local copy of argv[0] to a different memory location. Also, in what circumstances can argc be 0?
- tedunangst 14y agoint main() { char *args[] = { 0 }; execve("./zero", args, 0L); } zero will have argc == 0.
- mturmon 14y agoOn my MBP with gcc 4.2.1, it does work -- I tried it before posting. (Your interpretation of what it does is correct.)