CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: fscanf

  1. #1
    Join Date
    Feb 2001
    Posts
    872

    fscanf

    (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.



  2. #2
    Join Date
    Feb 2001
    Location
    Sydney, Australia
    Posts
    1,909

    Re: fscanf

    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)
    [email protected] | ICQ:57404554 | http://soukhov.com

    Russian Software Developer Network http://rsdn.ru
    Best regards,
    Igor Sukhov

    www.sukhov.net

  3. #3
    Join Date
    Feb 2001
    Posts
    872

    i've got it.

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured