Writing to OPENFILE crashing iPad

Previous topic - Next topic

Millerszone

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

Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

MrTAToad

Sure its not the COPYFILE command that is causing the crash ?

Millerszone

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
Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

MrTAToad

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 ?

Millerszone

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.
Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

Millerszone

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
Hardware: iMac 27", MacBook Air, PC 3.5Ghz Quad
Developing Tools: GLBasic SDK, Gideros Studio, PureBasic
Developing for: iOS, Android, Windows, OS X, webOS, HTML5

MrTAToad

That might be a little bug - post in the bug forums