Solved

Problem writing textfile with FPC (Free Pascal Compiler)

Posted on 2008-10-28
9
1,064 Views
Last Modified: 2013-11-11
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?
0
Comment
Question by:EXF_Pilatus
9 Comments
 
LVL 4

Expert Comment

by:GO-87
ID: 22821526
Do you assign a valid value to name before you call assign (file, name)?
0
 

Author Comment

by:EXF_Pilatus
ID: 22821631
Yes, excuse me.

'name' has a value:
name := 01of10_airfoil;
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22821656
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...
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:EXF_Pilatus
ID: 22822471
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;
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22822539
well you must convert it to string as far as i know...Otherwise, the thing will not work...
0
 

Author Comment

by:EXF_Pilatus
ID: 22829486
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.
0
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22833973
interesting, i was very sure it will give an error...Maybe some other Pascal Compiler...

Happy your problem is solved...
0
 

Accepted Solution

by:
ee_auto earned 0 total points
ID: 23268972
Question PAQ'd, 500 points refunded, and stored in the solution database.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Base1 Encode/Decode 3 81
What is wrong with the below insert statement. Getting error when executing. 5 45
VB.net and sql server 4 45
asp Google Map 2 23
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question