Possible Duplicate:
Deprecated conversion from string constant to char * error
I'm writting a program in C/C++ which is attempting to communicate over a UDP socket.
The code I'm working on has a variable, char *servIP
, which is set through an input parameter to the main function. However, I want the input parameter to be optional, so I have the code:
if(argc > 1)
servIP = argv[1]; /* First arg: server IP address (dotted quad) */
else
servIP = "127.0.0.1";
servIP
later gets converted into a more network-usable form.
When I compile this, I get a warning saying "warning: deprecated conversion from string constant to char*".
I assume this isn't the correct way to enter that IP address; what is a better way?