File input

This is a discussion on File input within the C Programming forums, part of the General Programming Boards category; when I write a program that reads a file in to the stream where do I place the file? Note: ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    43

    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

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

  2. #2
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    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, 01:44 PM
  2. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-22-2008, 12:19 AM
  3. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 02: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

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