fscanf syntex

This is a discussion on fscanf syntex within the C Programming forums, part of the General Programming Boards category; how can i cause to fscanf reading just those characters which are save in a file C(3) 200 300 NH3 ...

  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    12

    fscanf syntex

    how can i cause to fscanf reading just those characters which are save in a file

    C(3) 200 300
    NH3 1500 4000
    NaCl 300 400
    PPQ 200 100

    i want it to read all the data in the row after 2 spaces (the bold numbers) ...

    and another question fscanf reads those character as char or interger
    (i need them as integer)
    thanks

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    Use fgets() to read the whole line.
    Use the * prefix to some conversion (Eg. %*s) to skip fields you're not interested in.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Jun 2009
    Posts
    12
    thanks dude

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fscanf causes a SEGMENTATION FAULT
    By yougene in forum C Programming
    Replies: 15
    Last Post: 12-28-2008, 11:11 PM
  2. fscanf in different functions for the same file
    By bchan90 in forum C Programming
    Replies: 5
    Last Post: 12-03-2008, 08:31 PM
  3. fscanf causing a crash
    By dougwilliams in forum C Programming
    Replies: 6
    Last Post: 11-18-2007, 03:52 PM
  4. fscanf help
    By Axel in forum C Programming
    Replies: 13
    Last Post: 10-22-2006, 10:44 PM
  5. fscanf on sun's
    By brif in forum C Programming
    Replies: 2
    Last Post: 04-14-2002, 01:22 PM

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