Thread: Arrays and text files

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    28

    Arrays and text files

    I am trying to figure out how to get an input value from a text file rather than from a user, using arrays. Any help is greatly appreciated.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Look at the last post I made in Jeremy Duncan's thread. That's how to get a sentence, one by one, from a text file.

    You need to decide how you want to get the text, and what kind of an array you want to put the text into. fgets() is excellent for row by row kind of logic, The example I just posted, shows how you can use fgetc(). (The punctuation was removed in the example, but that's not necessary, of course)

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text Files
    By trekintouretter in forum C++ Programming
    Replies: 12
    Last Post: 01-06-2008, 05:34 PM
  2. Viewing other files... (Not Text Files)
    By Junior89 in forum C++ Programming
    Replies: 10
    Last Post: 07-05-2007, 02:30 AM
  3. text files in c++
    By DungeonMaster in forum C++ Programming
    Replies: 5
    Last Post: 03-14-2006, 03:48 PM
  4. text files
    By Hypercase in forum C++ Programming
    Replies: 4
    Last Post: 03-05-2005, 07:09 PM
  5. reading integers into arrays from text files
    By c_beginner in forum C Programming
    Replies: 6
    Last Post: 08-05-2004, 11:42 AM