Core Function FileWriteBinary

From Sputnik Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with "<pre> FileWriteBinary( <file>, <binary-array> ) </pre> === Description === Write the data from a binary variable to previously opened file at the current File Steam pointer loc...")
 
(Example)
Line 33: Line 33:
 
$File = FileOpen("MyFile.txt", "w")
 
$File = FileOpen("MyFile.txt", "w")
 
If isObj($File, "file") Then ; You could just use isObj($File) however adding the "file" will make sure it is indeed a file
 
If isObj($File, "file") Then ; You could just use isObj($File) however adding the "file" will make sure it is indeed a file
FileWrite( $File, $a )
+
FileWriteBinary( $File, $a )
 
FileClose( $File )
 
FileClose( $File )
 
EndIf
 
EndIf

Revision as of 13:47, 12 November 2011

FileWriteBinary( <file>, <binary-array> )

Contents

Description

Write the data from a binary variable to previously opened file at the current File Steam pointer location.

Parameters

file

A variable containing the File handle.

binary-array

The binary variable to write to the file.

Return Value

Success: Returns 1

Failure: Returns 0 if error occurs.

Remarks

You can set the File Steam pointer location with FileSeek( <file>, <offset>, <flag> ).

Example

$a = Pack("z0", "Hello World!")
$File = FileOpen("MyFile.txt", "w")
If isObj($File, "file") Then ; You could just use isObj($File) however adding the "file" will make sure it is indeed a file
	FileWriteBinary( $File, $a )
	FileClose( $File )
EndIf
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox