Thread: scanf a value ignoring a previous one

  1. #1
    Registered User
    Join Date
    Apr 2005
    Posts
    28

    scanf a value ignoring a previous one

    A very quick question. I need to scan and store the second value in a file but I am forgetting the syntax of fscanf. Let me illustrate it with an example.

    A file has one line, the following:

    1, 2

    I want to parse the line and store the second value (2).
    It will be

    fscanf(fp, "what_I_am_asking, %d\n, &number);

    What is the syntax of what_I_am_asking to ignore the first value, cause I am forgetting it?

    Cheers.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Just what manual pages were invented for.
    "%*d,%d"

  3. #3
    Registered User
    Join Date
    Apr 2005
    Posts
    28
    Thanks a lot. Both for the answer and for reminding me the man pages.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 6
    Last Post: 08-23-2008, 01:16 PM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. Quantum Random Bit Generator
    By shawnt in forum C++ Programming
    Replies: 62
    Last Post: 06-18-2008, 10:17 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. scanf - data is "put back" - screws up next scanf
    By voltson in forum C Programming
    Replies: 10
    Last Post: 10-14-2002, 04:34 AM