Solved

CArchive

Posted on 1998-07-30
3
372 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
ShiftLeft challenge 21 65
zeroMAx challenge 20 76
fix34  challenge 9 96
sumHeights2  challenge 7 75
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now