This is the expected behaviour when you use fgets() 'rawly'. It also 'catches' the '\n'. All you have to do is to 'clean-up' the string once you have got it (actually, fgets() is a 'line reader')Quote:
Originally Posted by Tyler_Durden
The usual and minimum trick is the "search'n kill" procedure:
Of course, it's more clever to stick this code in some function...Code:char *p = strchr(line, '\n'); /* needs <string.h> */
if (p != NULL)
{
*p = 0;
}