Mail Archives: djgpp/1998/07/27/02:00:45
Nicklas Lindgren wrote:
> I've tried making a pointer to a char in the string, and then
> implicitly converting it to an int. I used something like:
>
> char string[255];
> int x = 5;
> *(int *)&string[0] = x;
>
> // And for testing that it works:
> x = *(int *)&string[0];
> cout << x;
>
> The same number comes out in the other end, but it doesn't seem to end
> up in the string.
Of course it doesn't. ints and NUL-terminated character strings are not
the same thing.
--
Erik Max Francis / email max AT alcyone DOT com / whois mf303 / icq 16063900
Alcyone Systems / irc maxxon (efnet) / finger max AT sade DOT alcyone DOT com
San Jose, CA / languages En, Eo / web http://www.alcyone.com/max/
USA / icbm 37 20 07 N 121 53 38 W
\
/ I've got the fever for the flavor of a cracker
/ Ice Cube
- Raw text -