Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

CArchive

Posted on 1998-07-30
3
382 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 50 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to determine file rename from EventLog ? 2 55
if loop in java 3 153
ShiftLeft challenge 21 86
FizzBuzz challenge 9 82
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

829 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