Author Topic: Openfile readline issues  (Read 173 times)

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1177
    • View Profile
Openfile readline issues
« on: 2017-Oct-02 »
Hi Guys

Can anyone tell me what i have dont wrong in this function...
or did I stumble on a bug?


The prizes array is always the same size.

Code: GLBasic [Select]
FUNCTION savecoin:co%
LOCAL test$ //= GETCURRENTDIR$()+"Media/data/scr.txt"
test$ = PLATFORMINFO$("APPDATA") + "/g34222-g.dat"
LOCAL vv% = 0
LOCAL ok=TRUE

ok=OPENFILE(1,test$,FALSE)
IF ok=TRUE

        WRITELINE 1,ENCRYPT$("mystuff",co%)
       
        FOREACH pp IN prizes[]
        vv% = pp.frm
        WRITELINE 1,ENCRYPT$("mystuff",vv%)
        DEBUG vv
        NEXT
       
        CLOSEFILE 1
ENDIF


ENDFUNCTION


FUNCTION loadcoin:

LOCAL test$ //= GETCURRENTDIR$()+"Media/data/scr.txt"
test$ = PLATFORMINFO$("APPDATA") + "/g34222-g.dat"

LOCAL hsc$ = ""
LOCAL ok
LOCAL line$=""
LOCAL pz$=""
LOCAL pz=0

//KILLFILE PLATFORMINFO$("APPDATA") + "/g34222-g.dat"

ok= OPENFILE(1, test$, TRUE)
//KILLFILE PLATFORMINFO$("APPDATA") + "/g34222-g.dat"

IF ok=TRUE
        READLINE 1,line$
        hsc$ = DECRYPT$("mystuff",line$)
        IF hsc$ <> "" THEN RETURN hsc$
       
        FOREACH pp IN prizes[]
       
        READLINE 1,pz$
        pz$ = DECRYPT$("mystuff",pz$)
        DEBUG pz$
        pz=pz$
        pp.frm=pz
        NEXT
       
        CLOSEFILE 1
ENDIF



ENDFUNCTION

 

Basically the writing seems to work fine but the read version does not.
« Last Edit: 2017-Oct-02 by MrPlow »
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1177
    • View Profile
Re: Openfile readline issues
« Reply #1 on: 2017-Oct-02 »
Doooh!

Please ignore I seen the problem!!! I had a RETURN too early :)
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs