Forum > Windows

Problems with w'7 (not sure)?

(1/2) > >>

Bojan:
Hi,
It took me quite a while to figure out what was happening....
Firstly, my program (opening text file, reading it, storing lines in another file) was working.
Then, after closing FPC and opening it again, my source was opened automatically but execution from editor didn't work any more.. I was staring in screed confused, checking the simple code again and again... until I closed source, find it's location and open it again to get it work again as before

Also, I had similar problem with help files - every time after closing IDE, it seems it forgets where the help files were and I had to load them again for the new session.
What I need to do to avoid this hassle?

I have another problem:
 The following loop never ends:


 while (not EOF) do      // EOF is apparently not recognised, prog never stops.
     begin
      readln(MyFile, s);
      Writeln(Myfile_out, data);
     end;


MyFile has only 3 lines, but MyFileout could be of infinite length, if I do't stop the app.

Thank you!

Leledumbo:

--- Quote from: Bojan on January 12, 2017, 12:27:24 am ---I have another problem:
 The following loop never ends:


 while (not EOF) do      // EOF is apparently not recognised, prog never stops.
     begin
      readln(MyFile, s);
      Writeln(Myfile_out, data);
     end;


MyFile has only 3 lines, but MyFileout could be of infinite length, if I do't stop the app.

--- End quote ---
You're checking EOF of standard input, but reading from MyFile.

Handoko:
I like the way Leledumbo replied, telling what has done wrong without showing up the correct code, so the OP will learn from mistakes.

But if OP needs more clues, here has example code for comparing:
http://www.freepascal.org/docs-html/rtl/system/eof.html

Bojan:
Hi guys,
Thank you for the clues.
I will check the suggested link, the hint make sense (sort of...  I am not a programmer and my last encounter with Pascal was Borland Turbo Pascal 4 I think... I only need to do a simple data processing and TP doesn't work any more on 64-bit W'7....  so please be gentle with novice).

The first problem (with directories) however sis still pending...

turrican:
how did you opened the file?

Navigation

[0] Message Index

[#] Next page

Go to full version