If you use fgets(), you can only have one position for the newline: strlen() - 1. It can't be located anywhere else in the string.
Code://if line is the char array name: int len = strlen(line)-1; if(line[len]=='\n' line[len]='\0';
If you use fgets(), you can only have one position for the newline: strlen() - 1. It can't be located anywhere else in the string.
Code://if line is the char array name: int len = strlen(line)-1; if(line[len]=='\n' line[len]='\0';