OK I have the following:
char msg[1024];
int test = int(msg);
test++;
OK the msg variable gets the value 200. Why is test after this little code not 201, but 00? And what I have to change to get my 201 in test?
Printable View
OK I have the following:
char msg[1024];
int test = int(msg);
test++;
OK the msg variable gets the value 200. Why is test after this little code not 201, but 00? And what I have to change to get my 201 in test?
While syntactically correct, this is not doing what you think it's doing. Use the atoi function to convert a string to int.
int i = atoi( "17" );
or in you case
int test = atoi( msg );
hmm but than my programms crahes. msg is only a pointer to the real char variable. what can I do?Quote:
Originally Posted by nvoigt
How are you setting msg to 200?
why don't you change the msg to string or char*. It will be much easier.