Thread: File input

  1. #1
    Registered User
    Join Date
    Mar 2007

    File input

    when I write a program that reads a file in to the stream where do I place the file?
    Note: I'm using Ubuntu Linux

    int main(void){
    FILE* spIn;
    int numIn;
    spIn = fopen("rut.txt","r");
    while((fscanf(spIn,"%d",&numIn)) == 1)
        return 0;
    Last edited by mesmer; 11-07-2008 at 01:14 PM.

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Visalia, CA, USA
    Cool. If you have ubuntu, it also means you can use the following program in the future:

    man fscanf

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File transfer- the file sometimes not full transferred
    By shu_fei86 in forum C# Programming
    Replies: 13
    Last Post: 03-13-2009, 12:44 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  3. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  4. Totally confused on assigment using linked lists
    By Uchihanokonoha in forum C++ Programming
    Replies: 8
    Last Post: 01-05-2008, 04:49 PM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM