Solved

CArchive

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Decoding 32 bit binary streams 6 54
maven archtype selection in eclipse 1 58
bigDiff challenge 17 135
Problem to open Excel file 15 226
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.

726 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