
-----------------------------------
jamonathin
Tue Mar 06, 2007 1:49 pm

Scanning whitespace
-----------------------------------
Anybody know how to scan whitespace?

I need to be able to scan something like

Dear, world.

 I hate you so very, very much.

 Regards, Rosie O'Donnell

With the \n's and \t's in there.  Thanks bunch.

-----------------------------------
md
Tue Mar 06, 2007 3:02 pm

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
Tue Mar 06, 2007 4:13 pm

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

a.out < file.txt

-----------------------------------
md
Tue Mar 06, 2007 7:59 pm

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
Tue Mar 06, 2007 8:22 pm

Re: Scanning whitespace
-----------------------------------
Ah, KISS.

Thanks md.

-----------------------------------
haskell
Tue Mar 06, 2007 9:04 pm

RE:Scanning whitespace
-----------------------------------
This is C, right?

http://www.cplusplus.com/reference/clibrary/cstdio/fread.html

-----------------------------------
jamonathin
Wed Mar 07, 2007 11:18 am

Re: Scanning whitespace
-----------------------------------
Yeah, thats C.
