C Programming: Loop until EOF

In the while loop below, I need to break if EOF. I'm new to C, and am not sure how to accomplish this. I tried NULL below as well as EOF. When I do EOF, I get an error message saying: "warning: comparison between pointer and integer".

In other words, the program keeps asking for user input from STDIN, but needs to stop looping when user hits ^d.

Aspire to become a network administrator, network security analyst, or computer and information systems manager? Make the most of your experience as an IT professional by earning your B.S. in Network Operations and Security.

note, your input and output functions make not so much sense. they add complexity which is totally unneeded, for example string copy and string concatenation where you always have the risk of a buffer overflow. All that make the code more error-prone as it was without the functions. you only should use separate functions if it makes the code simpler (for example by avoiding redundancy) and/or more readable.

i also would use fopen, fwrite, fclose instead of open, write, close. it is not much difference but as you were using fgets for user input, it would make sense to use all functions of the same family.