[ back to toc ]

input/output

Date: 2002/05/12 19:28

Q:
I can't find any information on the input/output capabilities of C. I am
familar with C++, but keep running into dead ends b/c I am trying to use
C++ getch and cin commands. I have looked for examples on the Internet,
but they appear to be C++ and not truly C. What I am doing is creating a
server that is transferring messages for as many as three clients. So, I
need to know how to get input and send output with the server from the
client, as well as how the client can get input from the keyboard (the
user must be able to choose which other client its msg is being sent to,
as well as other manipulation of received messages). If you have any
information for me, I would greatly appreciate it.
A:
If you run your server from behind inetd then you can read stin and write
stdout. The functions are

fgetc, fputc, fprintf, fgets

to mention some.

If you write your server to be a standalone daemon then you have to
program socket programming. To learn that read Beej's guide. (search with
google for it)

regards,
Peter

[ back to toc ]