WRITEFILEDATA(3A) WRITEFILEDATA(3A)
NAME
WriteFileData - asynchronously write a block of data to a
file
SYNOPSIS
int WriteFileData (ready, error, arg, buf, size, name)
int (*ready)();
char *(*error)();
int arg;
char *buf;
int size;
char *name;
DESCRIPTION
WriteFileData writes binary data to a file. The name of the
file to read is in name. The buffer containing the data to
write is in buf and the number of bytes to write is in size.
The function ready is called when the data has been read,
and the function error is called upon an error. Either
function may be NULL, in which case it will not be called.
When there is an error, the file is closed, so exactly one
of the two functions ready and error is called. The
argument arg is passed to both routines.
The calling sequence for ready is as follows:
ready (arg)
int arg;
The argument arg is the argument supplied to WriteFileData.
The calling sequence for error is as follows:
error (arg, errno)
int arg;
int errno;
The user-supplied data to WriteFileData is passed in arg and
an error code interpreted the same as the system global
Page 1 (printed 9/3/91)
WRITEFILEDATA(3A) WRITEFILEDATA(3A)
variable errno is passed in errno .
WriteFileData returns -1 if there was an error setting up
the I/O procedure, or zero on success.
NOTES
There are lower-level asynchronous I/O routines AddIoProc
and RemoveIoProc that provide greater flexibility at the
expense of greater coding effort. WriteFileData uses these
routines to set up an asynchronous read procedure.
SEE ALSO
XtAppAddInput(3Xt), XtRemoveInput(3Xt), AddIoProc(3A),
RemoveIoProc(3A), ReadFileData(3A), ReadFileLines(3A),
ReadFileStrings(3A), ReadPipeData(3A), ReadPipeLines(3A),
ReadPipeStrings(3A), WriteFileLines(3A), WritePipeData(3A),
WritePipeLines(3A)
Page 2 (printed 9/3/91)