Thread: A matter of opinion

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    9

    Question A matter of opinion

    I am reading from a file of unknown length, but I need to store each line of that file for later use in my program. In addition, I will also need to use parts of each line later in my program. Should I read in each line as a string or read in per character? In your opinion as an experienced programmer, how should i approach this problem.

  2. #2
    Green Member Cshot's Avatar
    Join Date
    Jun 2002
    Posts
    892
    It really depends on what you want to accomplish. However it seems like you need to read each line anyways so just do that. Then when you need to specific information, you can parse each line you stored character by character. Perhaps you can be more specific on what you want.
    Try not.
    Do or do not.
    There is no try.

    - Master Yoda

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    9

    Specifics

    I will try to explain my program a little better. I am reading a file that contains information on people ( such as name, favorite food, favorite color, famous quote, phone number, and etc) that will only be separted by '/' on a line. Please note that each person has only one line of information. I will need to store that information so that I will not have to constantly open and close that file when i need to search for something specific or add a new person. I will also need to use each part of the person's profile either to modify or view. I was thinking of reading each line of the file and storing it into a string array. But when it comes time to store the person's data, I am not sure how to read in and separate each specific ( read in per character or as a string)? I hope I cleared things up a bit, without getting too lengthy.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Programming Opinion
    By tofugirl in forum C Programming
    Replies: 22
    Last Post: 11-25-2005, 09:15 AM
  2. Her opinion, your opinion
    By RoD in forum C++ Programming
    Replies: 4
    Last Post: 12-22-2002, 10:50 AM
  3. Neverending matter?
    By d00b in forum A Brief History of Cprogramming.com
    Replies: 41
    Last Post: 06-17-2002, 02:10 PM
  4. Freedom of opinion
    By Shiro in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 02-10-2002, 07:06 AM
  5. opinion about books
    By clement in forum C Programming
    Replies: 7
    Last Post: 09-24-2001, 04:18 PM