fscanf and new lines

This is a discussion on fscanf and new lines within the C Programming forums, part of the General Programming Boards category; Hi, Is it possible to manually change line when using fscanf? sort of like this: fscanf(inputFilePtr,"\n%c",&inputChar); And how doest he ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    1

    fscanf and new lines

    Hi,

    Is it possible to manually change line when using fscanf?
    sort of like this:

    fscanf(inputFilePtr,"\n%c",&inputChar);

    And how doest he pointer work, will it point to the first element in my file and then be incremented? If yes, can i manually increment it (inputFilePtr+something)?

    What I want to do is to read the first character in a line, if it is a # it is a comment and I will discard that line. Hence my wish to change the line


    /Mattias

    p.s Is there somewhere where I can look up all the things I can do with a command (as fscanf) so I don't have to ask people all the time.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Consider this FAQ entry on how to read a line. You're best served useing fgets, and after testing the first character, if you want to use the line, use [color=blue]sscanf[/url] to extract what you need.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21