File not open for output(pascal) [Solved/Closed]

Anonymous User - Jun 15, 2008 at 03:34 AM - Latest reply: KX 15735 Posts Friday May 30, 2008Registration date September 23, 2018 Last seen
- 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.
See more 

1 reply

Best answer
KX 15735 Posts Friday May 30, 2008Registration date September 23, 2018 Last seen - Jun 19, 2008 at 08:42 AM
4
Thank you
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.

Thank you, KX 4

Something to say? Add comment

CCM has helped 1851 users this month