Re: HELP: Class object I/O

From: klaas (jan_at_zonnet.ru)
Date: 10/09/03


Date: Thu, 09 Oct 2003 22:15:52 +0200

klaas wrote:
> Andreas Palsgård wrote:
>
>> Hey.. i want to write a class object containing both strings and
>> integers,
>> to a file on disk, and be able to read it properly again at another
>> time. I
>> made the code below... it doesn't work, but what am i doing wrong.
>>
> the problem is:
> you don't know the size of the data you are writing to the file in advance.
> You have to make any char * into a char[fixed_size]
> to be able to let any size_of(your_object) return a descent value.
> that way your reinterpret_cast<hex> won't fail....
>
> so no char * pointers please...
>
If you have the fixed size issue ready i can give you a wrapper class
that implement harddisk based arrays...
let me know



Relevant Pages

  • Re: Class object I/O
    ... i want to write a class object containing both strings and integers, ... > to a file on disk, and be able to read it properly again at another time. ... the most simple) by casting their pointer to char* and calling Write. ...
    (comp.lang.cpp)
  • inheriting from dataset
    ... Hey all, ... If I create a class that inherits from dataset how do I populate the dataset ... if the class object becomes the dataset? ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Pythonic indentation (or: beating a dead horse)
    ... (def initialize foo bar ... no strings of ends, but no significant whitespace, and vim users can ...
    (comp.lang.ruby)
  • Re: Help: OOP file I/O with C-strings
    ... >I want to write a class object with both strings and integers, to a file, ... reinterpret_cast on class types. ... Tom ...
    (comp.lang.cpp)