Solved

Problem writing textfile with FPC (Free Pascal Compiler)

Posted on 2008-10-28
9
1,060 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
Comment Utility
Do you assign a valid value to name before you call assign (file, name)?
0
 

Author Comment

by:EXF_Pilatus
Comment Utility
Yes, excuse me.

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

Expert Comment

by:jazzIIIlove
Comment Utility
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
 

Author Comment

by:EXF_Pilatus
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 12

Expert Comment

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

Author Comment

by:EXF_Pilatus
Comment Utility
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
Comment Utility
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
Comment Utility
Question PAQ'd, 500 points refunded, and stored in the solution database.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to adjust sheet 1 81
countPairs challenge 7 57
How  do I get an older program to run in Windows 10? 20 79
oracle query help 18 72
This is an explanation of a simple data model to help parse a JSON feed
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now