I am using the following conditional statement to read from standard input.
if ((n = read(0,buf,sizeof(buf))) != 0)
When inputting data fro
You better use fgets() for your task (catching user input), but even fgets() stores newline character in buffer.
fgets()
However if newline is there, you can be sure it is last character in the string so it is easy to strip it.