reading from text file

This is a discussion on reading from text file within the C++ Programming forums, part of the General Programming Boards category; What is a good way to read in a hundred 6-digit numbers from a text file example of what the ...

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

    reading from text file

    What is a good way to read in a hundred 6-digit numbers from a text file

    example of what the text file looks like:

    006214
    034567
    098765
    037465
    etc.

  2. #2
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    Code:
    int numbers[100];
    int i = 0;
    while(!inFile.eof())
    {
        inFile>>numbers[i];
        i++;
    }
    Last edited by 7stud; 04-25-2003 at 03:08 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  2. Inventory records
    By jsbeckton in forum C Programming
    Replies: 23
    Last Post: 06-28-2007, 04:14 AM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. Reading Character at a time from a text file
    By Giania in forum C Programming
    Replies: 8
    Last Post: 02-25-2006, 02:17 PM
  5. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 01:59 PM

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