Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have an MFC MDI application that reads data from some data logger card.It is storing data in *.tmp file located in %temp% folder as long as application is running .when i am trying to close app it is prompting to save or discard data.
when i press save it is storing in form of some document(App generated doc format).
and *.tmp file is getting closed after i close app.
when i load that document to application .tmp is generated in %temp% folder .

I am implementing similar kind of application and i need to store data read by my application somewhere like this and i have to show it on doc view format.

How to store large amount of data like this using docview architecture.
Posted

1 solution

The recommended method is to use a CArchive[^].
 
Share this answer
 
Comments
cnu reddy 23-Sep-14 4:25am    
thank u.

i know about CArchive, that it is used to serialize.
my doc file have serialize function .It is getting called during load and save .

I am storing data in linked list temporarily and passing it to CArchive's write() during save document.
But the size of the data i receive is not constant .So,i am using linked list to store data till data logging stopped.

while saving document i am passing linked list pointer to write() function .

As I am using dynamic memory allocation there is possibility of consuming all heap memory .

how to avoid this situation.Is there any other alternative method to store data during application running?

what is this .tmp file being generated in %tmp% folder,is this solution to my problem?
Richard MacCutchan 23-Sep-14 5:09am    
If you have more data than will fit in memory then you need to use some sort of temporary file to store it while the app is running. You can then copy it to permanent storage when the application terminates. How you do this is a matter of design, based on your application's requirements, there is no standard process for it.
cnu reddy 6-Oct-14 11:36am    
thanks for understanding my problem .
but how to create this temp file (should i use fopen() and create normal text file).
How to save it to disk(using serialization).

I want to save it to disk like some mdi document file(not like simple .txt file).


show me some sample code if possible.

Richard MacCutchan 6-Oct-14 11:42am    

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900