.title fwrite Output a record .ident /000002/ ; ;+ ; ; Index Output a record ; ; Usage ; ; int ; fwrite(object, sizeof (*object), nitem, iop) ; int nitem; ; FILE *iop; ; ; Description ; ; Object points to a buffer that is contains a specified ; number of items to be written to the file. ; ; fwrite() returns the actual number of items written. This will ; be zero if an error was encountered. ; ; Bugs ; ;- ; ; Edit history ; 000001 14-Oct-81 MM Initial edit ; 000002 29-Jun-82 MM Newer library .psect c$code fwrite:: jsr r5,csv$ mov c$pmtr+0(r5),r3 ;Get buffer pointer. mov c$pmtr+6(r5),r4 ;Get IOV pointer clr (sp) ;Clear item counter br 40$ ;And enter loop at test 10$: inc (sp) ;Writing another item mov c$pmtr+2(r5),r2 ;r2 := byte count for this item br 30$ ;And enter loop at test 20$: movb (r3)+,r0 ;Get the byte to r0 call $$putc ;and stuff it out 30$: dec r2 ;Drop the object size counter bge 20$ ;And get another if possible 40$: mov (sp),r0 ;Get number of items cmp r0,c$pmtr+4(r5) ;Done them all blt 10$ ;Continue if another bit #VF$EOR,V$FLAG(r4) ;But, if there's an error ;02 beq 50$ ;(not this time) clr r0 ;Return "no" items. 50$: jmp cret$ ;Exit from fwrite .end