Author Topic: I think to know why the error: wrt-request: fopen("", "wb") failed  (Read 1479 times)

Offline Dark Schneider

  • Mr. Polyvector
  • ***
  • Posts: 128
    • View Profile
I had this problem too, a code that works fine in Windows on iOS crash with the output in console:
Code: GLBasic [Select]
wrt-request: fopen("", "wb") failed
I follow the code and saw that while loading binary data from a file, I called a function that open another file, and then it crashes on iOS.
The code is something like:

Code: GLBasic [Select]
        LOCAL l_file%=GENFILE()
        IF OPENFILE(l_file, g_SaveDir$+"stages.sav",1)
                //version
                LOCAL l_version%, l_count%
                READULONG l_file, l_version
                //stages info
                LOCAL l_stage_info AS TStageInfo
                READLONG l_file, l_count
                FOR i%=0 TO l_count-1
                        l_stage_info.LoadFromFile(l_file)
                        StagesInfoSetData(stages_info[], l_stage_info, FALSE, FALSE, FALSE, FALSE)
                NEXT
                CLOSEFILE l_file
        ENDIF
 

And the function StagesInfoSetData(stages_info[], l_stage_info, FALSE, FALSE, FALSE, FALSE) opens a file because when I set data for stages it saves another file for sending data. Now I added the last boolean that if you se it is set as FALSE, if FALSE then it doesn't save this file, because in the inital load it should not be created.

Then, I think on iOS only 1 file can be open at the same time.

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10723
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
ouput the value of GENFILE - does it offer you the same channel, that's already open?
Would be cool to have a small example to test.

Offline Dark Schneider

  • Mr. Polyvector
  • ***
  • Posts: 128
    • View Profile
OK I'll work on it, in a few days, please excuse me because these days are some crazy for me, too busy  :giveup: