Easy. stdin and stdout are file descriptors 0 and 1. Just connect
these descriptors to whatever else you want to read from/write to. The
easiest way to do this is just to use shell redirection. For instance
typing
ls > filename
at a shell prompt connects the stdout of the ls program to the file
[filename].
I'm having trouble understanding what you intend to use this for, but it
sounds like maybe some kind of graphics work? Bad idea. File
reads/writes are sequential access whereas graphics is random access.
That is, you can put a pixel anywhere on the screen without running
through all the preceding pixels.
Zbigniew Zagórski wrote:
>
> Hi !
>
> I have a question about unix I/O system.
> Can i create a "virtual" file which works like i'want
> and is represented as file descriptor. I mean that
> i call write(fd,...) and the kernel instead read from pie,file
> or socket is calling user defined function ?
> I want do use it for redirection of stdin/out for
> grahics console (like quake). I want to do it so to
> program will call read /write to/from stdin/out like
> in text mode, and the result will be on screen or from screen!
> -------=====00000000=====-------
> Zbigniew Zagórski - LongmaN
> LO 12 Szczecin
> [EMAIL PROTECTED]
> -------=====00000000=====-------