Project

General

Profile

Bug #249

File saving not working

Added by Paul Kitching over 2 years ago. Updated 7 months ago.

Status:
In Progress
Priority:
High
Target version:
-
Start date:
02/23/2020
Due date:
% Done:

0%

Estimated time:
24.00 h
Affected version:

Description

I can read files, but saving them doesn't work. There is no error message, but the file doesn't seem to go anywhere and can't be read back in.

#manifest:"pc"
#displayWidth:1920
#displayHeight:1080
#fullScreen:true
#splashScreen:false
#fps:false

dim  scoretable$(10,2)
for x=1 to 10
  scoretable$(x,1)="Empty":scoretable$(x,2)="0"
next x
gosub readfile
for x=1 to 10
  print scoretable$(x,1),scoretable$(x,2)
next x
end

readfile:
if exist("highscore.dat")
  print "found":wait key
  open in 1,"highscore.dat"
  for loadrow=1 to 10
    input #1,scoretable$(loadrow,1)
    input #1,scoretable$(loadrow,2)
  next loadrow
  close 1
else
  print "not found":wait key
  gosub writefile
  print "Re-run (f5) to load created file."
end if
return

writefile:
open out 1,"highscore.dat"
for saverow=1 to 10
  print #1,scoretable$(saverow,1)
  print #1,scoretable$(saverow,2)
next saverow
close 1
return

Also available in: Atom PDF