[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

CArchive

Posted on 1998-07-30
3
Medium Priority
?
399 Views
Last Modified: 2013-11-19
My application file structure requires a direct access protocol that is incompatible with the file format produced by CArchive, which functions should I override?
0
Comment
Question by:Jason_G
3 Comments
 
LVL 1

Expert Comment

by:fkurucz
ID: 1320000
Look for "serialization: Serializing an Object" in the Help.
Toperators ">>" and "<<" or the function "serialize" has to be overwritten.

I think you already knew this and your question refers to an random access for serialized objects.

Because of the serialized pointers the only way I can see is to store each object (or group of objects) that are independent of each other separate in one file and add an index to refer to the objects.

0
 
LVL 2

Expert Comment

by:jstolan
ID: 1320001
If all you want to do is to serialize in a way that's different from the CArchive << and >> operators you don't need to override anything.  Just use the CArchive Read and Write functions to access the raw data in the way you need.  If you already have a file handler for the protocol, you can also use the CArchive GetFile function.
0
 
LVL 2

Accepted Solution

by:
AlFa earned 200 total points
ID: 1320002
You should use
      virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
      virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
in your document class.
in CDocument these functions open an CArchive and call Serialize(CArchive& ar).
So at this point you can implement all you need for your files.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question