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    | 
		 
		
			| 
				
	 | 
 
	
		| 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   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    
 
Best regards, 
Honza
		
		
		
 |  
	| 
		
	 | 
 
 
 |  
  
 
Goto Forum:
 
 Current Time: Tue Nov 04 14:58:20 CET 2025 
 Total time taken to generate the page: 0.09101 seconds 
 |