News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Problem with fileexist() and if in playbasic

Started by LemonWizard, January 01, 2012, 05:33:11 AM

Previous topic - Next topic

LemonWizard


if fileexist("C:/castlemap.txt")
readfile "C:/castlemap.txt", 1
rendertoimage castle
for tempx=1 to MAPWIDTH
for tempy=1 to MAPHEIGHT
solids(tempx, tempy).x1=readint(1)
solids(tempx, tempy).y1=readint(1)
solids(tempx, tempy).x2=readint(1)
solids(tempx, tempy).y2=readint(1)
x1=solids(tempx, tempy).x1
y1=solids(tempx, tempy).y1
x2=solids(tempx, tempy).x2
y2=solids(tempx, tempy).y2
ink rgb(0, 0, 255)
box x1, y1, x2, y2, 0
next tempy
next tempx
closefile 1
else
print "The file isn't there"
sync
waitkey
waitnokey
endif


this code doesn't work. no matter what I do it tries to read the file.
The file DOES NOT actually exist anymore on my hard drive.

LemonWizard

I had to delete the file using deletefile command INSIDE playbasic. Tested if the file exists outside my program and it did... wtf? I have show hidden files and folders enabled on my hd.