Re: Serializing __int64 in VC6
From: Murrgon (murrgon_at_hotmail.com)
Date: 09/15/04
- Next message: Manish Agarwal: "Re: Print screen??"
- Previous message: Robin Cull: "Serializing __int64 in VC6"
- In reply to: Robin Cull: "Serializing __int64 in VC6"
- Next in thread: Robin Cull: "Re: Serializing __int64 in VC6"
- Reply: Robin Cull: "Re: Serializing __int64 in VC6"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Sep 2004 11:14:51 -0400
How about just using the playing old Read() and Write() functions:
CArchive archive;
__int64 nMyValue = 10;
// Read it
archive.Read(&nMyValue, sizeof(__int64));
// Write it
archive.Write(&nMyValue, sizeof(__int64));
Robin Cull wrote:
> I'm using VC6 on X86. My application requires the use __int64 values
> which I need to serialize into archives. Although VC.NET has CArchive
> operators:
>
> CArchive& operator<<( ULONGLONG dwdw );
> CArchive& operator<<( LONGLONG dwdw );
>
> VC6 doesn't so my code generates errors on compilation:
>
> error C2679: binary '>>' : no operator defined which takes a
> right-hand operand of type '__int64' (or there is no acceptable
> conversion)
>
> error C2679: binary '<<' : no operator defined which takes a
> right-hand operand of type '__int64' (or there is no acceptable
> conversion)
>
> There are a number of ways I can get around this:
>
> - Subclass CArchive and add operators to support the 64 bit integer
> types
> - Convert my 64 bit integers into two 32 bit integers and serialize
> them individually
> - Convert my numbers into strings and serialize those (nasty but
> actually MS recommended in
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;168440)
> - Make a CObject derived class which holds an __int64 and serialize
> that
> - Make a structure that contains 2*32 bit integers and serialize that
> - More hacky ways to get around the problem
>
> I would have thought that this would have been solved before, but
> looking through the web and Groups it seems that there is precious
> little on it.
>
> Of my approaches above, which is the one I should persue? If they all
> look as horrible as I think they do, what approach do you recommend I
> use?
>
> I'm reluctant to write code that's probably been written before, does
> anybody have a sample I could steal to save the world from yet another
> poor solution to a trivial problem?
>
> Thanks all in advance.
>
> Regards,
>
> Robin
- Next message: Manish Agarwal: "Re: Print screen??"
- Previous message: Robin Cull: "Serializing __int64 in VC6"
- In reply to: Robin Cull: "Serializing __int64 in VC6"
- Next in thread: Robin Cull: "Re: Serializing __int64 in VC6"
- Reply: Robin Cull: "Re: Serializing __int64 in VC6"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|