The function fgets
might add a newline at the end of the string read. You’ll have to check that:
size_t ln = strlen(input) - 1;
if (input[ln] == '\n')
input[ln] = '\0';
or even
strtok(input, "\n");
The function fgets
might add a newline at the end of the string read. You’ll have to check that:
size_t ln = strlen(input) - 1;
if (input[ln] == '\n')
input[ln] = '\0';
or even
strtok(input, "\n");