Click to See Complete Forum and Search --> : fscanf


THY02K
February 21st, 2002, 09:40 AM
(1) How do u identify end of LINE with fscanf?

Any code fragment?

(2) How do u "skip" white spaces?

From MSDN:
"White-space characters: blank (' '); tab ('\t'); or newline ('\n'). A white-space character causes scanf to read, but not store, all consecutive white-space characters in the input up to the next non–white-space character. One white-space character in the format matches any number (including 0) and combination of white-space characters in the input."

It's not very clear without code sample.

THanx in advance.

Igor Soukhov
February 22nd, 2002, 05:32 PM
I think you should use stream classes instead of fscanf. In contrast to fscanf stream classes provide functions which read the whole line (e.g. getline).

Please - rate answer if it helped you
It gives me inspiration when I see myself in the top list =)

Best regards,

-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor@soukhov.com | ICQ:57404554 | http://soukhov.com

Russian Software Developer Network http://rsdn.ru

THY02K
February 22nd, 2002, 05:35 PM
I've done it with fscanf...

It was a lot of work to understand that there's an "invisible" file position pointer that moves everytime u call scanf... The API can be more user friendly definitely.

Anyway, I've got it. Thanx.