Pascal or Delphi? What do you have so far, and where are you stuck?
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
What you posted is Delphi code, but those functions still work. The following is a modified example from Delphi's Help to write a value to a text file:
var
F: TextFile;
d: Integer;
begin
d := 1;
AssignFile(F, 'C:\check.txt');
Rewrite(F);
Writeln(F, IntToStr(d));
CloseFile(F);
end;
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
Try it. You can find lots of examples in the help file.
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
Rewrite sets the file pointer to the beginning of the file for writing. Since you want to read, use Reset.
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
Step through it with the debugger and see where it fails in your code.
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
Set a breakpoint (using F5) on the first line in readcounter and start from there.
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86
for count:= 1 to (d) do with User[d] do
If User is an open array, then the count should be from 0 to d - 1. Apart from that, did you specify a length for the array using SetLength ?
pritaeas
Posting Prodigy
9,265 posts since Jul 2006
Reputation Points: 1,173
Solved Threads: 1,456
Skill Endorsements: 86