My C program doesn't seem to use fgets() the way I expect. It seems to not move the file-pointer to the end of the string returned by fgets(). See below for a code and output snippet:
This results in the output:Code:char tmpStr; fp = fopen(sFilename,"r"); fgets(tmpStr, sizeof(tmpStr), fp); printf("FilePointer = %d\n",ftell(fp)); printf("StringLength = %d\n",strlen(tmpStr)); printf("String = \"%s\"",tmpStr);
Why is the file pointer at 26? Shouldn't it be set to 30, which is the size of the string that was read in?Code:FilePointer = 26 StringLength = 30 String = "Data Output File Version: 1.2 "