Logan Shaw wrote:
Nigel Grant wrote:

[NG] I cant break up the line by replacing "|" with a "0", I need to
put both of the seperated fields into a structure & this cannot have
"0" at the end of either field.


All strings in C always end with a zero.

Oh, I need to clarify one thing, because I think I just understood your confusion.

The following two statements are NOT equivalent:

        string[5] = 0;
        string[5] = '0';

The first one writes the integer 0 into the string at position #5.
The second writes the character '0' into the string at position #5.
The character zero, if you are on a computer that uses ASCII, is
the integer 48.

So, when you type this:

        string[5] = '0';

if the compiler is creating code for a machine that uses ASCII, then
in effect the compiler translates your statement into this:

        string[5] = 48;

So, when you put 0 at the end of a string, you aren't putting the
character '0'.  You are putting the character NUL (ASCII code 0).
(Confusingly, ASCII NUL is not the same as C's NULL pointer value.)

Hope that helps.

  - Logan

--
For information on using the Palm Developer Forums, or to unsubscribe, please 
see http://www.palmos.com/dev/support/forums/

Reply via email to