%write() function

The %write() function writes the number of bytes designated by size from var to the file specified by file.descriptor returned by a previous call to %open(), %creat(), or %dup().


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


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

Note: When using the %write() function against a file that is opened in Text mode, some characters may be translated according to the underlying ‘c’ function for that platform.


if %write(fd,item,n)<n then crt "write error"