Posted by Kevin James on March 30, 2001 at 19:12:51:
In Reply to: probably seems ignorant heh posted by brent on March 30, 2001 at 18:53:00:
: whats the proper syntax to typecast a string to an integer?
: int(string.c_str()) compiles but its screwd up
You can't just typecast a string to an integer. When you do int( string.c_str() ) you're typecasting the char pointer for the string to an integer, so the integer value you're getting is the address of the string. To convert the string to an integer, write it to a string stream and then extract whatever you need from the stream.
Hope this helps.
Post a Followup