Roger Scudder wrote in a message to Tom Torfs:
TT> Because it doesn't work. The char may or may not be followed by a
TT> nul-byte. Most likely it will not.
RS> Yeah, I didn't think it through. I did some test's and it worked
RS> so I assumed it was OK.
If you defined the char as an int and you were running on a little-endian
machine this will probably always seem to work.
TT> Try this instead:
TT> strncat(stringvar, &charvar, 1);
TT> Although I still doubt this is conforming code...
RS> I think I'll just stick to the method I used in my reply to the
RS> originator of the thread.
That's best, because the above won't work for non-lvalue chars.
greetings,
Tom
tomtorfs@village.uunet.be
--- timEd/2 1.10+
---------------
* Origin: 80X86 BBS 32-15-24.62.32 V.34/V.FC (24h/24h) (2:292/516)
|