1 Replies - 722 Views - Last Post: 04 September 2008 - 02:51 AM Rate Topic: -----

#1 zerogee  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 91
  • Joined: 20-August 08

info on creating and reading files

Post icon  Posted 03 September 2008 - 08:10 PM

I am having a hard time understand writing and reading files. i have read a lot of literature but i can't seem to find the answers i'm looking for.

some facts; lets say i am writing a file of 5 records in an array. each record has 3 elements. let say i write the file with each element as a string. now my question;

1. without knowing how the file was written (ie...string, int, char, double) or the name of the element (or the format of those elements), but i do know the number of records and what each element (but not the order of these elements) are. how can you read a file in a program and load it into an array?

2. i assume when the file is written some tags are attached to each element but just not displayed in the .dat file?

i wrote a file like this and this was the dat in the .dat file;


etc.... is this how a program writes a file?

i hope i am making sense.

Is This A Good Question/Topic? 0
  • +

Replies To: info on creating and reading files

#2 gabehabe  Icon User is offline

  • GabehabeSwamp
  • member icon

Reputation: 1431
  • View blog
  • Posts: 11,006
  • Joined: 06-February 08

Re: info on creating and reading files

Posted 04 September 2008 - 02:51 AM

Try looking up fstream.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1