You're tired, Stefan... Get more sleep
Quote:
here is the problem!!!:
as soon as i try to read ONE character from the line, it does not work, ie:
Code:
sprintf(msg, "%s", sentence[1]);
|
...might work better if you were doing
sprintf (msg, "%c", sentence[1]);
instead, hmmm ?
If you do
sprintf (msg, "%s", sentence[1]);
and your "sentence" is something like "Hello my name is Stefan\n", you ask printf() to print out the STRING ("%s") that starts at the ADDRESS described by the 2nd element in the sentence[] array, that is, sentence[1] being 'ello' (since an int does 4 bytes), printf() will go and look for a string at address 0x656c6c7f (which is "ello" in hex) in memory, which is probably not what you want it to do !!!