NAME

srite - write an array to seplib tag


SYNOPSIS

int srite(tag, buffer, nbytes)


INPUT PARAMETERS

char*- tag
      tag of history file
int - nbytes
      number of bytes to be written
void*- buffer
      values to be written


DESCRIPTION

Writes out data to dataset attached to given tag


RETURN VALUES

n= number of bytes written


COMMENTS

The tag argument is either the string ``out'' or any tag appropriate for use with auxout(). This means either an explicit filename or a command line redirect parameter tag=filename. Buffer is the location of contiguous bytes from which the output will be written. Unless an end of file or I/O error is encountered, it is guaranteed that all nbytes bytes will be written; this is true even for terminals and pipes. In any event the number of characters written is returned.

Sreed and srite now perform conversions from machine independent external data formats to the internal data representation. For srite this defaults to ``xdr_float''. This may be overridden by ``data_format=...'' on the command line or (for tag=``out'' only) by a call to set_format(tag, "...") The valid types are ``xdr_float'', ``xdr_integer'', ``xdr_byte'', ``native_float'', ``native_byte'' and ``vplot''.

If the internal representation is larger than the representation of the external data then you must be careful to make nbytes the size of the converted data. e.g. on a cray system when writing xdr_float data, nbytes refers to the number of bytes to be written. This will be in 4-byte xdr_floats, but the internal storage will be in 8-byte cray floats, so the buffer must be 2*nbytes long.


SEE ALSO

the sreed manpage, the sseek manpage, the ssize manpage, the auxclose manpage


DIAGNOSTICS

If an end of file is reached, the returned byte count may be less than the requested amount. The next call will return zero. If the write was otherwise unsuccessful the program will be terminated via seperr(). Many conditions can generate an error: physical I/O errors, bad buffer address, preposterous nbytes, tag not that of an output file.


BUGS


KEYWORDS

write xdr output


LIBRARY

sep