writebytes - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : Output : writebytes

writebytes

writes bytes from a string or list to a file or pipe

 

Calling Sequence

Parameters

Description

Thread Safety

Examples

Calling Sequence

writebytes(file, bytes)

Parameters

file

-

file descriptor or filename

bytes

-

string, list of integers, or hardware Array

Description

• 

The writebytes function writes the specified bytes to the indicated file.

• 

writebytes returns a count of the number of characters written.

• 

If the bytes are a string, the characters in the string are written. It is not possible to write a zero byte using a string argument.

• 

If the bytes are a list of integers, each integer must be in the range 0..255. One byte is written for each integer.

• 

If the bytes are a hardware Array, the data in the hardware Array's data space is written. The format of this data is architecture dependent. The file is guaranteed to be re-readable only on the same architecture on which it was written, although it may be compatible between some architectures.

• 

If the file being written to is a STREAM or RAW file, and it is currently open in READ mode, it will be reopened in WRITE mode at the same offset. The file is opened with type TEXT if string data is used, or with type BINARY if list data is used.

• 

If a file name is given, and that file is not yet open, it is opened in WRITE mode. The file is opened with type TEXT if string data is used, or with type BINARY if list data is used.

Thread Safety

• 

The writebytes command is thread safe as of Maple 15.

• 

Parallel calls to file i/o commands on the same file descriptor will be serialized in an arbitrary order.  If you need the commands to execute in a particular order you must use Maple's synchronization tools to enforce this.  See Threads:-Mutex.

• 

For more information on thread safety, see index/threadsafe.

Examples

writebytestestFile,This is a test

14

(1)

writebytestestFile,65,66,67

3

(2)

filepostestFile,0

0

(3)

readlinetestFile

 This is a testABC

See Also

convert/bytes

file_types

fprintf

IO_errors

readbytes

writeline

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam