Thread: How to read inputs from file (please read the details before answering)?

  1. #1
    Registered User
    Join Date
    Feb 2014
    Posts
    3

    How to read inputs from file (please read the details before answering)?

    I have learnt recently how to use fgetc, fputc, fputs, fgets but still I am not able to figure out how to read values from a file like for example:
    12 14 1928 32993932
    17 98
    166 109 201
    These are separate integers & i want to read them and then manipulate these individual integers like going for 2*I1, 4*I2 and so on where I1 and I2 are 12 & 14.

    Tell me if I need to study something or have to know something more, please share link if possible.
    Last edited by charles22; 12-07-2014 at 06:19 AM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > where I1 and I2 are 12 & 14.
    So where do l1 and l2 come from later - more user input?

    And in this lxxx naming convention, what would 98 and 201 be?
    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.

  3. #3
    Registered User
    Join Date
    Feb 2014
    Posts
    3
    Look, these inputs have been given in any .txt file - I just want to read them and then manipulate them as per my usage in a program.
    Last edited by charles22; 12-07-2014 at 07:40 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 12-07-2012, 10:44 PM
  2. Read inputs separated by space
    By acpower in forum C Programming
    Replies: 2
    Last Post: 04-10-2012, 09:54 AM
  3. Replies: 3
    Last Post: 07-21-2011, 06:31 PM
  4. Replies: 2
    Last Post: 06-27-2011, 10:09 AM
  5. read file details
    By kodithuwa in forum C Programming
    Replies: 1
    Last Post: 11-05-2007, 12:27 AM