#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2010
    Location
    Location : Location : Location
    Posts
    66
    Rep Power
    0

    NEED GUIDANCE: Loading String from a .txt/.dat file into Arrays


    This is what's inside the .txt/.dat file :

    1534891, John Doe
    6686914, Jane Mary
    5854916, Kenny Wang
    First, I created 3 arrays,

    employeeID int array
    employeeFirstName char array size 30
    employeeLastname char array size 30

    and we're required to load the data (Strings) from the file into the arrays created. I'm attempting the question now, started off with fopen and other functions to load the file.

    I know:
    - need loops to do this
    - id and name is seperated with ', '
    - next person is in next line, seperated by 'lf' or x0A in Hex from ASCII table

    need some advise.
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Posts
    4,387
    Rep Power
    1871
    Don't broadcast your homework would be one bit of advice.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2010
    Location
    Location : Location : Location
    Posts
    66
    Rep Power
    0
    Originally Posted by salem
    Don't broadcast your homework would be one bit of advice.
    reason being?

IMN logo majestic logo threadwatch logo seochat tools logo