View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003110Studio Archive[All Projects] FunctionsPublic2012-05-02 13:132015-07-07 16:49
Assigned ToRussell Kay 
PriorityHighSeverityC - GeneralReproducibility100%
PlatformOSOS Version
Summary0003110: More issues when working with text files.
DescriptionArrr!! Again one more error when trying to work with text files.

Next code gives an error "File is not opened for reading."

f = file_text_open_write("test");
file_text_write_real(f, 0.00001);
file_text_write_real(f, -1001);
file_text_write_real(f, 4.4895);
file_text_write_real(f, 1057.4894);
file_text_write_real(f, -1581.1542);

f = file_text_open_read(f);
while (!file_text_eof(f))

If I'm trying to comment next two strings
while (!file_text_eof(f))
then I got error "Trying to close unexisting text file."

It doesn't work on windows and on android. Not tested on other platforms
GM Version
Attached Files? file icon Project1.gmz (Attachment missing)

- Relationships

-  Notes
kroart (Updater)
2012-05-02 14:40

Also created file has string "1e-005 -1001 4.4895 1057.49 -1581.15 " without space as first symbol. And therefore it reads number incorrectly.

This is fifth issue with text file read-write. Please make it work already.
Erik Leppen (Updater)
2012-05-02 15:55

Use file_text_writeln(f) after eacht write_real, and file_text_readln(f) after each read_real. Then, the text file will contain every number on a separate line.

Also, f = file_text_open_read(f) should be f = file_text_open_read("test"); f is not a valid filename, so therefore you get the "file is not opened for reading" error. However I think it should give the error "not a valid filename".

By the way, I'd like to suggest to YoYo to increase the precision of written reals because as I see it here, they're cut off after two decimals.
kroart (Updater)
2012-05-02 19:51
edited on: 2012-05-02 19:53

f = file_text_open_read(f); - oops. My mistake. Sorry. No error shows now.

And I'm agree with Erik Leppen. Precision may be more accurate. Need to post new issue for this wish I suppose?

Russell Kay (Manager)
2012-05-02 23:11

This was fixed a while back and I pointed out the error in the code back then..

Also reals are now written out at full precision Note: The first number is 1e-005 they are no longer stored at 2 decimal places...

Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker