@FILEWRITEB

Print Topic  Return to Overview  Previous Topic  Next Topic 

@FILEWRITEB[n,length,string] : Writes the specified number of bytes from the string to the file whose handle is n. Returns the number of bytes written, or -1 if an error occurred.

 

Note:  Writes ASCII output when passed a Unicode string. Note that if you're trying to write non-English (>128) characters with @FILEWRITEB, the output will probably not match the input.

 

If the length argument is -1, @FILEWRITEB will read the string argument as a series of ASCII values in decimal or hex to write to the file.  For example:

 

               echo %@filewriteb[%file,-1,0xe0 0xF2 0xA9]

 

Numeric input may be entered in either decimal format (series of digits 0-9) or in hexadecimal format ("0x" followed by a sequence of 0-F hex digits).

 

This function should only be used with file handles returned by @FILEOPEN! If you use it with any other number you may damage other files opened by TCC (or by the program which started TCC).

 

Beware of characters with special meaning to TCC, such as redirection and piping symbols, within the file. Use SETDOS /X with appropriate codes as needed.

 

See also the related handle-based functions:

 

@FILECLOSEClose a file handle
@FILEOPENOpen a file handle
@FILEREADRead next line from a file handle
@FILESEEKMove a file handle pointer
@FILESEEKLMove a file handle pointer to a specified line
@FILEWRITEWrite next line to a file handle
@TRUNCATETruncate the file at the current position of the file handle pointer

 

Topic "f_filewriteb.htm" last edited 1/28/2008. ©2008  JP Software, Inc.
Keywords: @FILEWRITEB