FreeBASIC  0.91.0
io_writefloat.c
Go to the documentation of this file.
1 /* write [#] functions */
2 
3 #include "fb.h"
4 
5 /*:::::*/
6 FBCALL void fb_WriteSingle ( int fnum, float val, int mask )
7 {
8  char buffer[8+1+8+1+2];
9 
10  fb_hFloat2Str( (double)val, buffer, 7, 0 );
11 
12  if( mask & FB_PRINT_BIN_NEWLINE )
13  strcat( buffer, FB_BINARY_NEWLINE );
14  else if( mask & FB_PRINT_NEWLINE )
15  strcat( buffer, FB_NEWLINE );
16  else
17  strcat( buffer, "," );
18 
19  fb_hFilePrintBufferEx( FB_FILE_TO_HANDLE( fnum ), buffer, strlen( buffer ) );
20 
21 }
22 
23 /*:::::*/
24 FBCALL void fb_WriteDouble ( int fnum, double val, int mask )
25 {
26  char buffer[16+1+8+1];
27 
28  fb_hFloat2Str( val, buffer, 16, 0 );
29 
30  if( mask & FB_PRINT_BIN_NEWLINE )
31  strcat( buffer, FB_BINARY_NEWLINE );
32  else if( mask & FB_PRINT_NEWLINE )
33  strcat( buffer, FB_NEWLINE );
34  else
35  strcat( buffer, "," );
36 
37  fb_hFilePrintBufferEx( FB_FILE_TO_HANDLE( fnum ), buffer, strlen( buffer ) );
38 }