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?
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 );
hth
-nv
She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."
When in doubt, read the FAQ.
Then ask a smart question.
hmm but than my programms crahes. msg is only a pointer to the real char variable. what can I do?Originally Posted by nvoigt
How are you setting msg to 200?
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
why don't you change the msg to string or char*. It will be much easier.
Hello, testing testing. Everthing is running perfectly...for now