Solved

CArchive

Posted on 1998-07-30
3
388 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
[X]
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
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

Independent Software Vendors: 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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 …
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.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

705 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