I’am trying to read a TXT file characters one by one and write it to
output.txt file one character’s ASCII num on each line.
Any time that my code receives EOF ASCII character I can’t read any other.
(This happen also on SUB character – meaning EOF in DOS)
this is my code (.c ):
while (source_size > 0) {
ch = fgetc(in_file); //reading file full of ASCII chars
fprintf(p, "%d\n", ch); // write num to output.txt
source_size--;
}
Thanks
You don’t specify an operating system or other info, but the word DOS suggests you are on Windows. Possibly you meant to open the file in binary mode (e.g. “FILE* in_file = fopen(name, “rb”)”).