Help with reading and writing to a file

Steve Torri storri at cse.wustl.edu
Fri Jun 11 18:33:41 CEST 2004


On Fri, Jun 11, 2004 at 06:16:38PM +0200, Michel Bardiaux wrote:
> >The binary file is attached. There are three uint32_t variables
> >printed before the two mpf_class followed by a uint32_t variable.
> >
> >Stephen
> 
> If you had posted the *dump* you would have looked at it and seen that 
> there is nothing between the 2 strings. So, when you read back in, the 
> runtime follows the normal rules: when reading a number, it stops when 
> it sees a non-digit. There are 8 consecutive digits so of course they 
> are read in as *one* number. You get zero for the 2nd one, you should 
> have checked for EOF.
> 
> My C++ is basic at best but I thing what you need is:
> 
> m_file_handle << val << ""

First, for future knowledge, what do you mean by a *dump*?

Second, If the extra "" is required then why is that not a part of the
operator<< function?

I have tried your suggestion on a simple test program. It does not
work. If you answer my first question I can post the simple test
program and the results in a dump format.

Stephen


More information about the gmp-discuss mailing list