Hullo every one
I have searched in google but with no clear success.
I am new to c++ programming
but i want to create a flat file using c++ codes that can be used to store a few records.
any help, codes, libraries,templates, tutorials and advice is most welcome
Thanks in advance
hi hamsterman
thanks for your fast response.
yes i mean like a txt file
but the program should be able to edit any record,read any record,delete a particular record and add a record to the existing database.
You will need to read about fstream. In this site there is a clear reference.
A class could be used to have a handle to your .txt file. Then you could read a file line by line and store these lines into a structure of your choosing i.e.
You could use a structure like vector<vector <std::string> > to store you file, where the index to the first vector will give you your entire row (record) and the index to the second vector could give you a particular field :
For example you can split a delimited line with a function like this :
And then use an enum to access the actual field. Then you can abstract the functions you mentioned (edit any record,read any record,delete a particular record and add a record to the existing database)