Hello, well, the following program opens a file and reads the first two strings that exist in the first line into two variables. The problem is that I’ve been trying to see what’s wrong with the following program, but I can’t see why it’s not working.
The compiler compiles it without any problem, but when I run it, it says exited with exitcode 2.
The problem is that the file exists.
What seems to be the problem?
Can anyone please help?
This is the code.
Program num;
Var
f:Text;
b,g:String;
c:String[1];
Procedure thenum (a:String);
Begin
Assign(f,'textfileoffile.txt');
Reset(f);
a:='A';
while not eof(f) and (a<>' ') do
begin
Read (f,a);
End;
Writeln(a);
End;
Procedure sth ( j:String);
begin
Assign(f,'textfileoffile.txt');
Reset(f);
j:='A';
while not seekEoln and eof(f) do
begin
read(f,j);
end;
Writeln(j);
End;
begin
Assign(f,'textfileoffile.txt');
repeat
Reset(f);
until eof(f);
thenum (b);
read(f,c);
sth (g);
if eof(f)then
Close(f);
Readln;
End.