cant read last char from a file
hey guys!
i make a code to open and read a text file.
Code:
while( fgets(tmpstr, 127, fp) ){
it runs ok. but when the file dont have a \n char being the last char in the file, my code cant read the last file's char.
file1---------------------
text 123
just junk text
more text
end file 1---------------
file2---------------------
text 123
just junk text
more text
end file 1---------------
if i try to read file2 i cant read the last char (t) on the file. But it not happens with file1 (once the t char isnt the last one)
I already tried using feof() but the same occurs.
I also tried to set but i cant make it work...