I am beginner in pascal programming. I apply the gpc-compiler on a computer at home, running under linux (suse 6.0 distribution). Some self made programs run well, but my problem is application of reset, rewrite commands. Please give me a hint, how to solve it. The situation: With the var g:text;s:string[5] in the main program the sequence s:='alpha'; rewrite(g,s); writeln(g,'test'); . results in a runtime-code a.out (o.k.) When I let run it applying ./a.out the program standing before the above given sequence runs well, but then it stops with ?Gpc runtime error:(gpc-rts)'Internal file namei wrong (#700)'. As a result a file named 'alpha' with zero content is created.
Applying the reset(g,s);readln(g,s1); I obtain ?GPC runtime error:File is not open for reading(#14).
What is my mistake? I would be highly thankful for a hint to solve the problem. Yours sincerely Michael Pfeiffer
I think you might want to add an 'assign(filevar,filename)' before any reset or rewrites... Also remember a 'close(filevar)' at the end.
Best regards
Preben Bohn
--- michael pfeiffer pfeifferm@buntzel.b.shuttle.de wrote: > I am beginner in pascal programming.
I apply the gpc-compiler on a computer at home, running under linux (suse 6.0 distribution). Some self made programs run well, but my problem is application of reset, rewrite commands. Please give me a hint, how to solve it. The situation: With the var g:text;s:string[5] in the main program the sequence s:='alpha'; rewrite(g,s); writeln(g,'test'); . results in a runtime-code a.out (o.k.) When I let run it applying ./a.out the program standing before the above given sequence runs well, but then it stops with ?Gpc runtime error:(gpc-rts)'Internal file namei wrong (#700)'. As a result a file named 'alpha' with zero content is created.
Applying the reset(g,s);readln(g,s1); I obtain ?GPC runtime error:File is not open for reading(#14).
What is my mistake? I would be highly thankful for a hint to solve the problem. Yours sincerely Michael Pfeiffer
===== The two rules for success are: 1. Never tell them everything you know.
____________________________________________________________ Nokia Game is on again. Go to http://uk.yahoo.com/nokiagame/ and join the new all media adventure before November 3rd.
I am beginner in pascal programming. I apply the gpc-compiler on a computer at home, running under linux (suse 6.0 distribution). Some self made programs run well, but my problem is application of reset, rewrite commands. Please give me a hint, how to solve it. The situation: With the var g:text;s:string[5] in the main program the sequence s:='alpha'; rewrite(g,s); writeln(g,'test'); .
This should work. However, with such a code snippet I can't do anything. If you want any help, post a *complete* program that does not behave as expected, and specify the compiler version (gpc -v).
Frank