Reset Command

Am trying to read in some input from a file and keep getting an error message titled.

"Types of actual and formal var parameters must be identical"

Have managed to use the rewrite function to save the information to a file but cannot seem to be able to get it back

Any help would be very useful.
This bit of code doesn't work and I cannot see why

if OpenECFC.Execute then
begin
Caption := 'Quiz .txt';
AssignFile(FO,'quiz.txt');
Reset(FO);
Readln(FO);
Readln(FO,NumberTeams);
for y := 1 to NumberTeams do
Readln(FO,TeamNames[y]);
CloseFile(FO);
end;

This bit of codes works.

if SaveECFC.Execute then
begin
Caption := 'ECFC Centenary Quiz 1904-2004 '+SaveECFC.FileName;
AssignFile(FS, SaveECFC.FileName+'.txt');
Rewrite(FS);
Writeln(FS,'Number Teams');
Writeln(FS,NumberTeams);
for y := 1 to NumberTeams do
Writeln(FS,TeamNames[y]);
CloseFile(FS);
end;


Comments

  • : Am trying to read in some input from a file and keep getting an error message titled.
    :
    : "Types of actual and formal var parameters must be identical"
    :
    : Have managed to use the rewrite function to save the information to a file but cannot seem to be able to get it back
    :
    : Any help would be very useful.
    : This bit of code doesn't work and I cannot see why
    :
    : if OpenECFC.Execute then
    : begin
    : Caption := 'Quiz .txt';
    : AssignFile(FO,'quiz.txt');
    : Reset(FO);
    : Readln(FO);
    : Readln(FO,NumberTeams);
    : for y := 1 to NumberTeams do
    : Readln(FO,TeamNames[y]);
    : CloseFile(FO);
    : end;
    :
    : This bit of codes works.
    :
    : if SaveECFC.Execute then
    : begin
    : Caption := 'ECFC Centenary Quiz 1904-2004 '+SaveECFC.FileName;
    : AssignFile(FS, SaveECFC.FileName+'.txt');
    : Rewrite(FS);
    : Writeln(FS,'Number Teams');
    : Writeln(FS,NumberTeams);
    : for y := 1 to NumberTeams do
    : Writeln(FS,TeamNames[y]);
    : CloseFile(FS);
    : end;
    :
    :
    :
    See main board for probable answer.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion