Stellan Alm wrote:
> I'm doing an asignment in school, and have to use printf and scanf to
> talk
> between mother and child.
> I can't find any documentation about this.
If you are unfamiliar with the relationship between the stdio
functions (scanf, printf, etc) and the low-level POSIX I/O functions
(read, write etc), you should refer to the libc Info file.
> It works fine with read() and write(), but how do I know which
> filedescriptor to use
> when I doing it with scanf and printf ?
scanf and printf don't reference any descriptors. scanf reads from
stdin, whilst printf writes to stdout. fscanf and fprintf take a
stream (a `FILE *') as an argument. You can create a stream for a
specific descriptor using fdopen().
The main issue with using stdio functions when communicating between
processes is that the functions may buffer the output. You should call
fflush() on an output stream to force any buffered data to be written
to the underlying descriptor.
> Is it possible to send a whole string or do I have to take each
> character by them selve ?
No, you can send whole strings.
--
Glynn Clements <[EMAIL PROTECTED]>