safe data

i have a C++ program used by two people. the first writes a report (complain for example) and the second one checks the report and reply to that complain.
so i want to know how to allow the first user to safe that report and enable the second user to check it out after the first user close the program??
i dont want to use database, can i use arrays??? if yes, pls how??
You could use a database like sqlite. But if it's just homework, you could write the data to a formated text file.
pls can u tell me how to write the data to a formatted text file???
can i use array or not???
Normally, when you talk about a program "used by two people", you're talking about two different instances of the program. Saving a complaint in an array won't work because that array will be local to the each instance of the program and won't be shared. Therefore, you will want to save the information in a file.

The first instance of the program would write the data to a file and the second instance of the program would read the data from the same file.
See http://www.cplusplus.com/reference/iostream/ofstream/ for writing data to a file and http://www.cplusplus.com/reference/iostream/ifstream/ for how to read data from a file.

You could identify each query with an id, use R to indicate a report, and A then a number for each answer. Then write a single line for each entry. For example:
1
2
3
4
R1: i have a C++ program used by two people.
R1A1: You could use a database like sqlite.
R1A2: pls can u tell me how to write the data to a formatted text file?
R1A3: You could identify each query with an id


At the start you read the whole thing into memory with some data structure that matches each report with the sequence of answers.

At the end, you rewrite the file.
AbstractionAnon, ur solution is the most suitable for my problem. i want to build " write_complain function and read_complain function" i want these two functions to be called by different function by using if else.
so my question is, can i do that?? if yes, pls can u give me hint on that??
i have been through the links u gave me but i couldnt understand it cos i am still new in C++
pls do help me
big thanks for others. i really appreciate your help.
Topic archived. No new replies allowed.