Re: How to Read/Write objects to and from a file?
From: Geoff Schwab [MSFT] (a-geosch_at_online.microsoft.com)
Date: 03/31/04
- Next message: Geoff Schwab [MSFT]: "Re: Install CF"
- Previous message: gfeighny: "Re: URGENT! Create Database Error"
- In reply to: stevebju: "How to Read/Write objects to and from a file?"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 31 Mar 2004 12:47:28 -0800
Hi Stephen,
Another possible solution if you want to come as close to load-in-place as
you can for managed code is to implement your class as a byte array with
properties that access the members. Then you can simple write the byte
array to the file and load it directly from the file.
For those who are not familiar with the term, load-in-place is a method of
mapping data in a file directly to data in memory. In C++ you would do this
by allocating a class instance and then loading a file directly into the
pointer to the instance (of course, a v-table can cause issues here).
-- Geoff Schwab Program Manager Excell Data Corporation http://msdn.com/mobility http://msdn.microsoft.com/mobility/prodtechinfo/devtools/netcf/FAQ/default.aspx This posting is provided "AS IS" with no warranties, and confers no rights. "stevebju" <brownst4@engr.sc.edu> wrote in message news:108F28AE-612D-41A5-B977-9B386160E18A@microsoft.com... > I'm having the hardest time reading and writing a simple class object to and from a file in the CF. Could someone show me how to write a class object to a file? Then if I have multiple objects in a file, how do I read them out one by one? > > Thanks, > Stephen
- Next message: Geoff Schwab [MSFT]: "Re: Install CF"
- Previous message: gfeighny: "Re: URGENT! Create Database Error"
- In reply to: stevebju: "How to Read/Write objects to and from a file?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|