Thread: reading from text file

  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,663
    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, 03:17 PM
  5. A bunch of Linker Errors...
    By Junior89 in forum Windows Programming
    Replies: 4
    Last Post: 01-06-2006, 02:59 PM