Link to home
Start Free TrialLog in
Avatar of EXF_Pilatus
EXF_Pilatus

asked on

Problem writing textfile with FPC (Free Pascal Compiler)

Hi experts!

With my FPC-written-program (with a Linux computer) I want to write a large textfile. I use the following commands:

file : text;
name: shortstring;
assign(file, name);
rewrite(file);
writeln(file, 'blablabla');
...
close(file);

When compiling it doesn't give any problems. However, when I run the program, the following error presents itself:
EInvalidOp : Invalid floating point operation
$00000000004A1A8B
$000000000049F434

Does anybody know what can be the problem?
Avatar of GO-87
GO-87

Do you assign a valid value to name before you call assign (file, name)?
Avatar of EXF_Pilatus

ASKER

Yes, excuse me.

'name' has a value:
name := 01of10_airfoil;
Avatar of jazzIIIlove
Hi there;

It seems large file is the problem... Any opportunity to split the file inyo ch1uncks?
The error is most likely a floating point stack overflow. This I guess is an x86 limitation.

Another most important consquence about this is that TEXT files contains only strings.

Best regards...
Hi Jazzllllove

Exactly, this is what I thought as well. Splitting up the file is what I did before but this does not help unfortunately: when splitted up, the second part of the file writes until the same line as at did in the unsplitted version.

It seems the program can only write a max number of lines. It is peculiar though that there isn't enough memory available since it is a cluster of processors with which I run this program...

1 question:
- Does it matter if I write an integer onto this textfile? for example:
writeln(file, i,' is an integer.');
where i := 1;
well you must convert it to string as far as i know...Otherwise, the thing will not work...
Hmm, that is what one would expect yes. However, it gives no error when doing the following:
writeln(file, 'This is an integer: ', i);
where i is an integer.

Anyway, I found out what I did wrong. It was not the number of lines that gave an error, or integers in a 'writeln'-command. I divided by '0' in one of the formulas in the same unit. (stupid, I know.)

Thanks anyway for your help.
interesting, i was very sure it will give an error...Maybe some other Pascal Compiler...

Happy your problem is solved...
ASKER CERTIFIED SOLUTION
Avatar of ee_auto
ee_auto

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial