.title writef ;+ ; integer function writef(buf, n, int) ; ; character buf(n) ; integer n, int ; ; this routine writes the n bytes from the buffer buf to the file ; int. It returns as its value the number of bytes written, or ; ERR if an error occurs during the write. ;- ap=%5 buf=2 n=4 int=6 .mcall put$ .psect $r.roi,con,ro,rel,lcl,i .enabl lsb writef:: mov @int(ap),r0 ; ratfor unit number call r$gfbk ; get RFDB address into r1 bcs 10$ ; c set => invalid unit bit #rf.clo,(r1) ; is the file open? bne 10$ ; NO put$ r.fdb(r1),buf(ap),@n(ap) ; write the next record bcs 10$ ; c set => error mov @n(ap),r0 ; return number of bytes written return 10$: mov #err,r0 ; return(ERR) return .end