Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0003110GameMaker: Studio[All Projects] Functionspublic2012-05-02 13:132013-03-05 15:33
Reporterkroart 
Assigned ToRussell Kay 
PriorityHighSeverityC - GeneralReproducibility100%
StatusclosedResolutionfixed 
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);
file_text_close(f);

f = file_text_open_read(f);
while (!file_text_eof(f))
    show_message(string(file_text_read_real(f)));
file_text_close(f);

If I'm trying to comment next two strings
while (!file_text_eof(f))
    show_message(string(file_text_read_real(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 [^] (168,890 bytes) 2012-05-02 13:13

- Relationships

-  Notes
(0001565)
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.
(0001570)
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.
(0001579)
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?

(0001586)
Russell Kay (developer)
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...

- Issue History
Date Modified Username Field Change
2012-05-02 13:13 kroart New Issue
2012-05-02 13:13 kroart File Added: Project1.gmz
2012-05-02 14:40 kroart Note Added: 0001565
2012-05-02 15:55 Erik Leppen Note Added: 0001570
2012-05-02 17:23 Mike Dailly Assigned To => Russell Kay
2012-05-02 17:23 Mike Dailly Status new => assigned
2012-05-02 19:51 kroart Note Added: 0001579
2012-05-02 19:52 kroart Note Edited: 0001579 View Revisions
2012-05-02 19:53 kroart Note Edited: 0001579 View Revisions
2012-05-02 19:53 kroart Note Edited: 0001579 View Revisions
2012-05-02 23:11 Russell Kay Note Added: 0001586
2012-05-02 23:11 Russell Kay Status assigned => resolved
2012-05-02 23:11 Russell Kay Resolution open => fixed
2013-03-05 15:33 Ross Manthorp Status resolved => closed


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker