Search code examples
cfgets

fgets adds an interrogation mark


Possible Duplicate:
carriage return by fgets

I have this code:

char arch[80];
fgets (arch, sizeof(arch), stdin); 

When I access the value of arch it shows the value I have entered from stdin followed by an interrogation mark, why is this happening?


Solution

  • My guess is that it represents the \n line terminator in whatever you use to examine the value of arch. SO has a lot of questions regarding the line termination, I'm sure you can easily find a number of ways to deal with it.