GLBasic forum

Main forum => GLBasic - en => Topic started by: Millerszone on 2011-Jan-27

Title: Writing to OPENFILE crashing iPad
Post by: Millerszone on 2011-Jan-27
Using the sample code below crashes the iPad. On windows it works o.k.
Using INIOPEN and INIPUT to the same filePath$ works on the iPad.

Code (glbasic) Select

filePath$ = PLATFORMINFO$("DOCUMENTS") + "/localhighscoreTest.dat"

COPYFILE "Media/localhighscoreTest.dat", filePath$

OPENFILE( 1, filePath$, FALSE)
WRITELINE 1, "John Doe"
WRITELINE 1, "999"
WRITELINE 1, "01/27/2011"
CLOSEFILE 1

Title: Re: Writing to OPENFILE crashing iPad
Post by: MrTAToad on 2011-Jan-27
Sure its not the COPYFILE command that is causing the crash ?
Title: Re: Writing to OPENFILE crashing iPad
Post by: Millerszone on 2011-Jan-27
Quote from: MrTAToad on 2011-Jan-27
Sure its not the COPYFILE command that is causing the crash ?
COPYFILE works. Tested with code below.

Code (glbasic) Select
filePath$ = PLATFORMINFO$("DOCUMENTS") + "/localhighscoreTest.dat"

COPYFILE "Media/localhighscoreTest.dat", filePath$
ok = OPENFILE(1, filePath$, TRUE)
IF ok
READLINE 1, readField$
PRINT readField$, 1, 10
READLINE 1, readField$
PRINT readField$, 100, 10
READLINE 1, readField$
PRINT readField$, 200, 10
CLOSEFILE 1
ENDIF
SHOWSCREEN
MOUSEWAIT
Title: Re: Writing to OPENFILE crashing iPad
Post by: MrTAToad on 2011-Jan-27
Now, do you know whether its the OPENFILE command causing it or one of the command between the OPENFILE and CLOSEFILE ?  And are you sure that the file is present ?  Did it attempt to start reading the data ?
Title: Re: Writing to OPENFILE crashing iPad
Post by: Millerszone on 2011-Jan-27
Quote from: MrTAToad on 2011-Jan-27
Now, do you know whether its the OPENFILE command causing it or one of the command between the OPENFILE and CLOSEFILE ?  And are you sure that the file is present ?  Did it attempt to start reading the data ?
Yes the file is present, because the code above read the file in the iPad Document directory
and printed to the screen.

I'll have to check if the problem is the OPENFILE with Write mode or the WRITELINE command.
Title: Re: Writing to OPENFILE crashing iPad
Post by: Millerszone on 2011-Jan-27
I forgot to add a line in the first post that I was using in my game code.
It was the WRITELINE 1, "" causing the iPad crash.
WRITELINE 1, "" worked fine on the PC, but the iPad didn't like it.
I used a linefeed for the end off file. I will now be using ENDOFFILE
and remove WRITELINE 1, ""

Code (glbasic) Select
filePath$ = PLATFORMINFO$("DOCUMENTS") + "/localhighscoreTest.dat"

COPYFILE "Media/localhighscoreTest.dat", filePath$

OPENFILE( 1, filePath$, FALSE)
WRITELINE 1, "John Doe"
WRITELINE 1, "999"
WRITELINE 1, "01/27/2011"
WRITELINE 1, ""   < -----  causing the iPad to crash
CLOSEFILE 1



Thanks MrTAToad
Title: Re: Writing to OPENFILE crashing iPad
Post by: MrTAToad on 2011-Jan-27
That might be a little bug - post in the bug forums