basic.%write

C Function/BASIC Program, Releases: AP/Unix

Writes to a Unix file.

Syntax

n=%write(file.descriptor, variable, size)

Description

writes the number of bytes desinated by 'size' from 'variable' to the file specified by 'file.descriptor' returned by a previous call to '%open()', '%creat()' or 'dup()'.

This function returns the number of bytes actually written. If the length of variable is less than size, the content of the string written is undefined, as is usual in C. No data translation occurs.

Example

n=len(item)
if %write(fd,item,n)<n then crt 'write error'

See Also

Command Name Type Description
basic.%whex C Function Writes to a Unix file, converting into binary.
basic.%creat C Function Creates new Unix file, or rewrites to existing file.
basic.%dup C Function Returns new file descriptor.
basic.cfunc Definition can be called from a Pick/BASIC program or subroutine in AP/DOS and AP/Unix implementations using a syntax similar to that of normal C.
basic.cfunction Definition Declare a list of C functions.
basic.%ttyname C Function Returns a pointer to a terminal name.
basic.%open C Function Opens a Unix file for reading or writing.
basic.%lseek C Function Sets Unix file pointer.

User Comments

What do you think?

Share your experience or ask a question by using the form below.

Login to leave your comments.