Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File handling

Status
Not open for further replies.

newbie14

Technical User
Feb 14, 2009
81
MY
Dear All,
I need to do a small c++ application. The problem here is that an application which will keep details on each subject and their breakdown.
For example I have a subject list like this

AN123 Assignments 50%, Labs 20%, Test 30%
AN244 Assignment 1 25%, Assignment 2 25%, Assignment 3 50%
AN022 Development projects 50%, Test 50%

So my problem here is that accordingly for each subject I want to keep the marks for each breakdown accordingly. Is there any idea how can I keep all this in a text file and read it accordinly. Off course I can open a file in C++ but I dont know how to read and store dynamic values.
 
hi,
to perform well this task, you need a DB, with keys, field, ecc. A trik that I use when I cannot use these tools,
(ie I have to write a script from shell), is to get help from directory structure:

You create a Dir called YourAppl, and inside create 3 subdirs: AN123, AN244, AN022.
Inside AN123 create 3 files: Assignments, Labs, Test.

Inside Assignments write 50, inside Labs write 20...

If you need other fiels, you can use 2nd row of each files,
or deep the dir structure or prefix filenames with keys.

Probably this is not the solution you were looking for,
but I believe this can help you now and in other more complicated situations in which you cannot/want not use DB.

ciao
vittorio
 
Dear Victory,
Thank you for your reply. So besides the database off course I can do it? So there is no way I can do it with files is it? Thank you.
 
hi,
probably my english is not good, and I have not understood your answer. Is my 1st post not enough clear using files
to perform the program ?

For any specific questions, post it. Did you need code?

ciao
vittorio
 
Dear Victor,
Yes if you some code will be good and much appreciated. Thanks.
 
instead of the directory structure you can can use

structures (or classes) and store the data in ONE file.

for that you'll have to study access to binary file.

or try serialization with class-data

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top