can someone tell me how can I change the name of a process after a for();
normally it's done by changing argv[0], but how should it be done in a new process ?
This is a discussion on change argv[0] after fork within the C Programming forums, part of the General Programming Boards category; can someone tell me how can I change the name of a process after a for(); normally it's done by ...
can someone tell me how can I change the name of a process after a for();
normally it's done by changing argv[0], but how should it be done in a new process ?
I'd suppose that it should work the same way in the new process as it does in the old process. The forked process gets its own copy of argv[].
Insert obnoxious but pithy remark here
Maybe you could do something like this
Code:#include <stdio.h> int main(int argc, char *argv[]) { argv[0] = "vvvv"; printf("%s\n", argv[0]); return 0; }