Dec 1, 2013 at 9:25am
I try to understand what is the problem with this code
1 2 3 4
|
char name[NAME_LEN],id[ID_LEN],act[REQ_MSG];
scanf("%s %s %s",act,id,name);
sprintf(s2.mtext,"%s %s %s",act,id,name);
printf("s2.mtext is: %s\n",s2.mtext);
|
s2.text is a part of a struct,
and lets say: s2.mtext=char [50].
Can you see where is the problem?
I get the wrong string... :-(
Thank you!
Last edited on Dec 1, 2013 at 10:10am
Dec 1, 2013 at 8:10pm
And if I'm doing it with spaces?
It will be good to?
Thank you!
Dec 2, 2013 at 7:54am
I just checked and, yes it works. I think it works for any kind of space: tabulation, simple space, new lines...
Do you still have problems ?