an inquiry about 4.2 stdio.h
Chris Torek
chris at umcp-cs.UUCP
Fri Jun 28 19:55:49 AEST 1985
> "IOSTRG" tells [stdio] not to do something dumb with that stream,
> like trying to do real live I/O into or from the buffer.
I probably shouldn't be putting more verbiage onto the net, but I
can't let this go by without comment.
One would *think* that this is what _IOSTRG does. In fact _IOSTRG
has no effect whatsoever. If you run the following under 4.1 or 4.2BSD,
it will write to file descriptor 0:
#include <stdio.h>
main() {
struct _iobuf io;
char place[3];
io._cnt = 3;
io._base = io._ptr = place;
io._flag = _IOWRT|_IOSTRG;
_doprnt("testing...", 0, &io);
exit(0);
}
(The io._base initialization is just to make it something other
than NULL, since it's in zero filled stack space.)
To make it work properly, you have to (get this) take away _IOWRT.
Properly, by the way, means it should put ``tes'' into place[]
and then return a failure indication.
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251)
UUCP: seismo!umcp-cs!chris
CSNet: chris at umcp-cs ARPA: chris at maryland
More information about the Comp.unix
mailing list