quick question: File Input

This is a discussion on quick question: File Input within the C Programming forums, part of the General Programming Boards category; Hi, Im a little new to the C language and could use some help. I understand that gets( ) can ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    5

    quick question: File Input

    Hi,

    Im a little new to the C language and could use some help.

    I understand that gets( ) can be used to read a line of input from stdin, as can sscanf etc

    and I understand that fscanf can be used to read input from files.

    what I would like to know is,

    is there any function in the C library that resembles gets() but can be applied to a file?

    essentially I am looking to read input from a file, one line at a time.
    The reason I don't want fscanf is because I dont know how many values I want to read in ie it varies.

    essentially, I have a variable :

    char buf[256] ;

    and in the way that this works:

    gets(buf) ;

    I would like something similar, except reading from file instead of stdin.

    Thanks in advance

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    5
    never mind ppl.....


    i figured it out lol ....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. File input in C++ - S1mple question...
    By darknite135 in forum C++ Programming
    Replies: 4
    Last Post: 12-23-2007, 07:44 AM
  3. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  4. Trouble with a lab
    By michael- in forum C Programming
    Replies: 18
    Last Post: 12-06-2005, 10:28 PM
  5. Quick File Input Question
    By ProjectsProject in forum C Programming
    Replies: 2
    Last Post: 11-04-2004, 10:39 AM

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