We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hello to everyone, i would like to read strings with scanf.
scanf("%s",&text);
My strings are normal spoken sentences. So there are blanks included in the string. Scanf terminates string- reading on 'blank'. Is there a workaround or should I write my own procedure with reading only characters
scanf("%c",&my_char)
then making decisions to put them in a string and terminate on CR LF. Sorry this is no especiall Keil thread, but would be nice to share some ideas :-)
The function scanf only does what it does. If you need something different, write your own function. That's all there is to it. You might get some insights from freebsd's implementation of scanf: www.freebsd.org/.../vfscanf.c
Regards, - mike
You are right, How about,
if(space), if (next space), check for next space again yes, => end of sentence, else, read next word,
as they are spoken sentences, there should not be more than 2- spaces between 2 consecutive words, could increase no of spaces to 3 or 4.
Does end of file or sentence end with null character, '\0' or '/0' Is <space> not counted as a character,