How's it going:
How do you use fopen() to establish a stream to console I/O (keyboard)? What I needed to do is read in data from the console I/O and then send it elsewhere using fputs. I just don't know what the first argument for fopen("here", r) would be. Oh, and this is an event driven program (chatting); and the fopen will be part of a read event handler. I am supposed to read data from the console using fgets and then send it out to the other recipient using fputs. Thanks.

Recommended Answers

All 2 Replies

How's it going:
How do you use fopen() to establish a stream to console I/O (keyboard)? What I needed to do is read in data from the console I/O and then send it elsewhere using fputs. I just don't know what the first argument for fopen("here", r) would be. Oh, and this is an event driven program (chatting); and the fopen will be part of a read event handler. I am supposed to read data from the console using fgets and then send it out to the other recipient using fputs. Thanks.

Its not necessary to use fopen to open the console keyboard -- its already open when the program starts. You can use stdout, stdin or stderr.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.