: : i dont know whether it is related to the problem or not, but
: : you have to close the file after processing.
: :
: : : I have a code to read a file and write a file on the screen, but on some textfiles it stops to early with writing, and when I later in the progam progress the file it is not completely progressed is there a way to entirely progres the file
: : :
: : :
: : : var fileloc : string;
: : : textfile : text;
: : : temp : char;
: : :
: : : begin
: : : readln(fileloc);
: : : assign(textfile, fileloc);
: : : reset(textfile);
: : : while not eof(textfile) do
: : : begin
: : : read(textfile, temp);
: : : write(temp)
: : : end;
: : : end.
: : :
: : :
: :
: :
: yes i know that i have done it already, this is just a part of the entire code, the problem is not fixed with that.
: the code is to encode and decode files, it only happens with coded files.
:
Then the coded files contain the end-of-file symbol before the actual eof. I would suggest an alternate method of loading using a file of char:
var
f: file of char;
ch: char;
FileLength, i: integer;
begin
Assign(f, fileloc);
Reset(f);
FileLength := FileSize(f);
for i := 0 to FileLength-1 do
begin
read(f, temp);
write(temp)
end;
Close(f);
end;
This should read the entire file and display it on the screen.