WRITEU

The WRITEU procedure writes unformatted binary data from an expression into a file. This procedure performs a direct transfer with no processing of any kind being done to the data.

Calling Sequence

WRITEU, Unit, Expr 1 ..., Expr n

Arguments

Unit

The IDL file unit to which the output is sent.

Expr i

The expressions to be output. For non-string variables, the number of bytes implied by the data type is output. When WRITEU is used with a variable of type string, IDL outputs exactly the number of bytes contained in the existing string.

Unix Keywords

TRANSFER_COUNT

Set this keyword to a named variable in which to return the number of elements transferred by the output operation. Note that the number of elements is not the same as the number of bytes (except in the case where the data type being transferred is bytes). For example, transferring 256 floating-point numbers yields a transfer count of 256, not 1024 (the number of bytes transferred).

This keyword is useful with files opened with the NOSTDIO keyword to the OPEN routines. Normally, writing more data than an output device will accept causes an error. Files opened with the NOSTDIO keyword will not generate such an error. Instead, the programmer must keep track of the transfer count to judge the success or failure of a WRITEU operation.

VMS Keywords

Note that the obsolete FORWRT routine has been replaced by WRITEU.

REWRITE

When writing data to a file with indexed organization, setting the REWRITE keyword specifies that the data should update the contents of the most recently input record instead of creating a new record.

Example

Create some data to store in a file by entering:

D = BYTSCL(DIST(200))

Open a new file for writing as IDL file unit number 1 by entering:

OPENW, 1, 'newfile'

To write the data in D to the file, enter:

WRITEU, 1, D

Close file unit 1 by entering:

CLOSE, 1

See Also

OPEN , READU