Re: Serializing __int64 in VC6

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Murrgon (murrgon_at_hotmail.com)
Date: 09/15/04


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



Relevant Pages

  • Re: Serializing __int64 in VC6
    ... > which I need to serialize into archives. ... > look as horrible as I think they do, what approach do you recommend I ... > poor solution to a trivial problem? ...
    (microsoft.public.vc.mfc)
  • Re: fast and accurate in mixed mode operations
    ... Just as a matter of style, I would recommend using a KIND parameter ... The assembler code should be the same, ... I used to dislike using implicit type conversion because I thought ...
    (comp.lang.fortran)
  • Re: Accessing "PPC Unfriendly" Web Sites
    ... I also recommend my articles written on this subject; ... example explained how for example PIEPlus 2.x can be used to ... Please see the Pocket PC Mag Expert Blog at ... as well as it's possible bookmark conversion urls to return easily... ...
    (microsoft.public.pocketpc)
  • Re: Display pdf files 1st page in the imagebox in asp.net
    ... You need to use 3rd party tools for conversion. ... I'd recommend this one http://www.o2sol.com/pdf4net/products.htm ... "The greatest danger for most of us is not that our aim is too high and we miss it, but that it is too low and we reach it" Michelangelo ...
    (microsoft.public.dotnet.languages.csharp)