writef (2) --- write raw words to file 03/25/82 _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n integer function writef (buf, nw, fd) integer buf (ARB), nw file_des fd Library: vswtlb (standard Subsystem library) _F_u_n_c_t_i_o_n 'Writef' is used to write words to a file, which may be assigned to any device recognized by the Subsystem. (A word on the Prime is 16 bits long.) The first argument is a string of words to be written to the file; the second argument is the number of words to be written; the third argument is the file descriptor of the file to which data will be written. Words are transferred from the string buffer to the file until 'nw' words are written. The func- tion return is ERR if the file is not writeable, if the given file descriptor is invalid, or if the file's error flag is set; otherwise, the function return is the number of words written (nominally the same as 'nw'). Exceptions: a write on the null device (/dev/null) always returns EOF, and an error detected by Primos causes a return of EOF. _I_m_p_l_e_m_e_n_t_a_t_i_o_n 'Writef' calls 'mapsu' to convert standard port numbers into file descriptors. If the last operation performed on the file was not a 'writef', 'flush$' is called to empty the file's buffers. Depending on the device type associated with the file, one of the device dependent drivers 'dwrit$' (for disk files) or 'twrit$' (for terminal files) is called to perform the actual data transfer. _C_a_l_l_s mapsu, dwrit$, twrit$, flush$ _B_u_g_s Support for more devices would be nice. EOF is returned if any error occurs when writing to disk (in dwrit$); the user is not informed of the actual error that occurs. _S_e_e _A_l_s_o mapsu (2), dwrit$ (6), twrit$ (6), flush$ (6) writef (2) - 1 - writef (2)