Is there a way to check for a newline in stdin without getting rid of the newline? If there isnt can you write to stdin like with a function? I tryed fputc and it didn't work to well so Im assuming you can't. Anyone know for sure?
Is there a way to check for a newline in stdin without getting rid of the newline? If there isnt can you write to stdin like with a function? I tryed fputc and it didn't work to well so Im assuming you can't. Anyone know for sure?
Hey thanks for the reply. Yea you guessed it I was trying to use scanf to read a number and validate it without removing the newline but I couldn't figure it out, so I ended up using fgets which works great. I'll have to look into nonblocking file descriptors and select thanks.