daver@hcx1.UUCP (12/15/86)
> ... I have never seen a standard C library routine that > did not perform as documented. I don't know if "putw" is considered standard, but it does not behave as documented (at least on our bsd4.2-vintage C "system"). The man page states that it returns the word written or EOF. In fact, a successful call returns 0 , not the word written. I posted this to net.lang.c a while back and was told that the problem was due to putw's returning an int and not being able to distinguish an EOF from a valid integer. Dave Ray uucp: {codas,allegra}!novavax!hcx1!daver
jc@piaget.UUCP (John Cornelius) (12/24/86)
In article <44600001@hcx1> daver@hcx1.UUCP writes: > > >> ... I have never seen a standard C library routine that >> did not perform as documented. > >I don't know if "putw" is considered standard, but it does not behave >as documented (at least on our bsd4.2-vintage C "system"). The man >page states that it returns the word written or EOF. In fact, a successful >call returns 0 , not the word written. > >I posted this to net.lang.c a while back and was told that the problem >was due to putw's returning an int and not being able to distinguish an >EOF from a valid integer. > The 3B2 (System-V) also returns 0 from putw. Apparently whoever wrote it felt that there was no value in returning the put-ed value since it could not be made to return error codes that were not puttable values. There is is casual remark (no such thing in a Unix manual, right?) under diagnostics that indicates that ferror should be used for error checking. Fact of the matter is that putw doesn't return anything so ferror is the only way to get information about how it performed. -- John Cornelius (...!sdcsvax!piaget!jc)