Skip to content

Commit 5fe24b9

Browse files
author
Paul Robson
committed
Fixed open. Stupid
1 parent efe9643 commit 5fe24b9

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

basic/test.bsc

+8-17
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
sound 0,100,100,14
2-
end
1+
if exists("test.txt") then mos "del test.txt"
32

4-
call snd(0,660,50,0,0,100)
5-
call snd(0,440,50,0,0,30)
6-
end
7-
8-
proc snd(ch,fq,ms,sl,ty,v)
9-
while peek($FF00):wend
10-
poke $FF04,ch
11-
doke $FF05,fq
12-
doke $FF07,ms
13-
doke $FF09,sl
14-
poke $FF0B,ty
15-
poke $FF0C,v
16-
poke $FF01,7
17-
poke $FF00,8
18-
endproc
3+
open output 1,"test.txt"
4+
print #1,"Hello world"
5+
close 1
6+
cat
7+
open output 1,"test.txt"
8+
close 1
9+
cat

firmware/common/sources/interface/fileinterface.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ uint8_t FIOSetFileAttributes(const std::string& filename, uint8_t attribs) {
311311
uint8_t FIOOpenFileHandle(uint8_t fileno, const std::string& filename, uint8_t mode) {
312312
if (mode == FIOMODE_RDWR_CREATE) { // If open truncate
313313
uint8_t exists;
314-
if (FIOExistsFile(filename,&exists) == 0) { // If file exists
314+
FIOExistsFile(filename,&exists);
315+
if (exists) { // If file exists
315316
uint8_t error = FIODeleteFile(filename); // try to delete it, as we truncate it anyway !
316317
if (error) return error;
317318
}

0 commit comments

Comments
 (0)