I would like to ask how can I accept \r\n
without changing it to \\r\\n
, with fgets
.
I want the program to translate the \r\n
to a newline character instead of printing it as a string.
Current code:
char buff[1024];
printf("Msg for server: ");
memset(buff, 0, sizeof(buff));
fgets(buff, sizeof(buff), stdin);
printf(buff);
Input:
test\r\ntest2
The output I want:
test
test2
My current output:
test\r\ntest2