File not open for output(pascal)

Solved/Closed
Anonymous User - Jun 15, 2008 at 03:34 AM
KX Posts 16752 Registration date Friday May 30, 2008 Status Moderator Last seen August 31, 2024 - Jun 19, 2008 at 08:42 AM
Hello, guys, I have a problem in my program, when I try to run this program I heva the 'erro:file not open for output' I cant uderstand why ,cuz, I guess I open the file with rewrite comand, please help me is verry important for me and is urgency.
the program is this:

program ler_fich;
var d:string[7];
q:integer;
p,vt:real;
fe,fs:text;
begin
assign(fe,'artigo.txt');
reset(fe);
assign (fs,'resultados.res');

while eof (fe) do

rewrite(fs);
begin
readln(fe,d,q,p);
vt:=q*p;
writeln(fs,d,q,vt);
end;
readln;
close(fs);
end.

thanks for all of you that answer my question.
Related:

1 response

KX Posts 16752 Registration date Friday May 30, 2008 Status Moderator Last seen August 31, 2024 5
Jun 19, 2008 at 08:42 AM
Try that :
program ler_fich;

var d:string[7];
    q:integer;
    p,vt:real;
    fe,fs:text;
begin
assign(fe,'C:\...\artigo.txt');
reset(fe);
assign (fs,'C:\...\resultados.res');
rewrite(fs);
while not eof (fe) do
      begin
      readln(fe,d,q,p);
      vt:=q*p;
      writeln(fs,d,q,vt);
      end;
close(fs);
close(fe);
readln;
end.
0