Re: Serializing __int64 in VC6
From: David Crow [MCSD] (david.no.spam.crow_at_pbsnow.no.spam.com)
Date: 09/15/04
- Next message: RNEELY: "RE: MFC ActiveX (VARIANT_BOOL) type methods always return TRUE"
- Previous message: GuitarBill: "Re: can i get HBITMAP from HICON in an easy eay?"
- In reply to: Robin Cull: "Serializing __int64 in VC6"
- Next in thread: Uwe Kotyczka: "Re: Serializing __int64 in VC6"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 15 Sep 2004 14:47:10 -0500
I did this once as an exercise by deriving a class from CArchive, called
CArchiveEx, and provided << and >> operators that handled the __int64 type.
"Robin Cull" <robin.cull@gmail.com> wrote in message
news:dddbb1a7.0409150702.2853721e@posting.google.com...
> 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: RNEELY: "RE: MFC ActiveX (VARIANT_BOOL) type methods always return TRUE"
- Previous message: GuitarBill: "Re: can i get HBITMAP from HICON in an easy eay?"
- In reply to: Robin Cull: "Serializing __int64 in VC6"
- Next in thread: Uwe Kotyczka: "Re: Serializing __int64 in VC6"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|