Thread: Reading a formatted text file

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    1

    Unhappy Reading a formatted text file

    Hello everyone

    I need some help reading data from this text file and storing them appropriatly:

    example:

    Mike 19 Male Newyork student
    Pamela 24 Female Chicago doctor
    ....

    the first column is for names, the second is for age, the third is for gender ,the fourth is for city and the fifth is for occupation. I need to store each one in an appropriate array.
    N.B the space between each field(values) is a \t

    And sorry for not providing any code simply because i couldn't do it
    Thanks in advance.

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    You have formatted input. So you should use a formatted input function. Read up on *scanf, and "strings" in general.

  3. #3
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    And sorry for not providing any code simply because i couldn't do it
    We're sorry you didn't read your book or attend your classes and take notes. We aren't able to that for you, and not interested in doing homework assignments for students, endlessly.

    You post up your code, and tell us what the problem is with it, and we'll be glad to help.

    Help, but not do it for you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Reading output into a text file
    By pete212 in forum C Programming
    Replies: 8
    Last Post: 04-23-2008, 05:11 PM
  2. 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
  3. Reading text file twice, can it be done once?
    By CaeZaR in forum C++ Programming
    Replies: 4
    Last Post: 02-04-2006, 04:18 PM
  4. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 03:17 PM
  5. Replies: 3
    Last Post: 03-04-2005, 02:46 PM

Tags for this Thread