Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » put32 for double precision values..
Re: put32 for double precision values.. [message #35487 is a reply to message #35486] Wed, 22 February 2012 15:27 Go to previous messageGo to previous message
dolik.rce is currently offline  dolik.rce
Messages: 1791
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Monty.mvh wrote on Wed, 22 February 2012 14:22

Hi,

FileOut function put32 will write integer values into file..
Is there a way where i can put double precision values (say 3.142) directly into file..


Hi Monty,

Yes and no Smile You could use ugly casting trick and and force the double to go through the Put32 function (or better Put64 - double is 64bit on most platforms!).

Much better in this case is to use Put():
double d = 3.142;
FileOut f;
// ...
f.Put(&d, sizeof(double));

That should do exactly what you want. To read it, you can use similarly:
FileIn f;
// ...
f.Get(&d,sizeof(double));


In fact, you can store almost any plain data type like this Wink

Best regards,
Honza
 
Read Message
Read Message
Read Message
Previous Topic: CoWork and shared memory
Next Topic: division by zero check
Goto Forum:
  


Current Time: Sun Jun 15 12:25:55 CEST 2025

Total time taken to generate the page: 0.04269 seconds