Iphone Problems reading binary file

Previous topic - Next topic

kaotiklabs

Hi mates,

I have problems while trying to read a binary .dat file.
I use    OPENFILE(1,"file.dat",1) and read it later with READUWORD 1,value.

I don?t have any problems on a Windows machine but on an Iphone there?s a segmentation fault.
I?ve checked several times that the file has the correct path and is located on the media folder of the project.
Other files, like sprites load correctly.

Using the debugger I?ve found this line:

<notice> request: fopen ("file.dat", "rb") failed
<notice> shut down GLB

Any clue??
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

trucidare

you only can open files in Media folder for reading.
if you want to write to a file use the documents path (PLATFORMINFOS$("DOCUMENTS")) copy your file from Media do documents and then open and write and read.

MacBook Pro 2,2 GHz Core 2 Duo, 4 GB RAM, 160 GB HDD, 8600M GT
Core i3 - 3,07 GHz, 8 GB Ram, 2.5 TB HDD, Geforce GTX 260+ OC

kaotiklabs

#2
Trucidare, I understand that for writing, but I?m jus trying to read a binary .dat file inside the Media folder.
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

MrTAToad

Are you checking to make sure the file exists ?

kaotiklabs

Yes, it exists.

Could be maybe something related with permisions?
I will try to debug it harder today.
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

fjsantosb

Hi.

I was a problem too writting files on iPhone side. Althought my mainly problem wasn't exactly this, i found some problems using SETCURRENTDIR method.
Try to comment this method and loadsprites using Media/sprite1.png, etc, maybe it can works!

Best Regards, fjsantos.
Francisco Santos Belmonte founder of Tip Tap Games.
Website: www.tiptapgames.com
Twitter: www.twitter.com/tiptapgames
Facebook: http://dld.bz/dYVd
iPhone News & Sales: www.gamesappetizer.com

Stu_C


also the iPhone is case sensitive on the folder name and the filename.

/Stu
/Stu
www.ovine.net

kaotiklabs

Finally solved it reorganizing the folders structure and changing the paths.

I thought, glbasic starts searching directly on the media folder, but had to explicitly force the path, like this way, "Media/file.dat".
It seems I misunderstood how to use the new glbasic .app estructure..., but is rare, was working fine on Windows.
Just for info, I?m not using the setcurrentdir method.

Maybe the default path behaviour is different trough this platforms?
Vote Cthulhu! Because the stars are right!!!!
Ia Ia Cthulhu F' tang!

Stu_C


No its the same for all platforms.

Just make sure you have a media folder in the .app folder for win32 and a copy of it int the iPhone Xcode Media folder



/Stu
www.ovine.net