Posted: Tue Mar 06, 2007 1:49 pm Post subject: Scanning whitespace
Anybody know how to scan whitespace?
I need to be able to scan something like
Quote:
Dear, world.
I hate you so very, very much.
Regards, Rosie O'Donnell
With the \n's and \t's in there. Thanks bunch.
Sponsor Sponsor
md
Posted: Tue Mar 06, 2007 3:02 pm Post subject: RE:Scanning whitespace
what do you mean by "scan"? If you mean parse a string, then yes it's super easy. If you mean remove whitespace, then that too is easy.
jamonathin
Posted: Tue Mar 06, 2007 4:13 pm Post subject: Re: Scanning whitespace
Ah sry i ment with user input. How would i scanf/fgets something like that. Or if I were to have it in a file where i would do something like
Quote:
a.out < file.txt
md
Posted: Tue Mar 06, 2007 7:59 pm Post subject: RE:Scanning whitespace
so you want to read in input including whitespace? The easiest way is just to read in characters and add them to a string. There are other ways involving reading entire lines and stuff, but those are slightly more complex.
jamonathin
Posted: Tue Mar 06, 2007 8:22 pm Post subject: Re: Scanning whitespace
Ah, KISS.
Thanks md.
haskell
Posted: Tue Mar 06, 2007 9:04 pm Post subject: RE:Scanning whitespace