Files
BlitzNext/_release/help/commands/2d_commands/WriteFloat.htm
T

78 lines
2.2 KiB
HTML
Raw Normal View History

2014-12-08 12:43:20 +13:00
<html>
<head>
<title>Blitz3D Docs</title>
<link rel=stylesheet href=../css/commands.css type=text/css>
</head>
<body>
<h1>WriteFloat (filehandle/stream, myFloat)</h1>
<h1>Parameters</h1>
<table>
<tr>
<td>
filehandle/stream = a valid variable set with the OpenFile, WriteFile command, or OpenTCPStream (v1.52+)
<br />
myFloat = a floating point variable
</td>
</tr>
</table>
<h1>Description</h1>
<table>
<tr>
<td>
Once you've opened a disk file (or stream) for writing, use this command to write a single floating point number to the file. Note, each value written uses 4 bytes.
<br />
<br />
Streams can only be used in Blitz Basic v1.52 or greater.
</td>
</tr>
</table>
<h1><a href=../2d_examples/WriteFloat.bb>Example</a></h1>
<table>
<tr>
<td>
; Reading and writing a file using ReadFloat and WriteFloat functions
<br />
<br />
; Initialise some variables for the example
<br />
Num1# = 10.5 ; store 10.5
<br />
Num2# = 365.25 ; store 365.25
<br />
Num3# = 32767.123 ; 32767.123 is the largest positive Short Integer Value in BlitzBasic )
<br />
Num4# = -32768.123 ; -32768.123 the largest negative Short Integer Value in BlitzBasic )
<br />
<br />
; Open a file to write to
<br />
fileout = WriteFile("mydata.dat")
<br />
<br />
; Write the information to the file
<br />
WriteFloat( fileout, Num1 )
<br />
WriteFloat( fileout, Num2 )
<br />
WriteFloat( fileout, Num3 )
<br />
WriteFloat( fileout, Num4 )
<br />
<br />
; Close the file
<br />
CloseFile( fileout )
<br />
2014-02-26 16:08:39 +13:00
2014-12-08 12:43:20 +13:00
<br />
2014-02-26 16:08:39 +13:00
; Open the file to Read
2014-12-08 12:43:20 +13:00
<br />
2014-02-26 16:08:39 +13:00
filein = ReadFile("mydata.dat")