Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / i need help with my coding cant write to file

Author
Message
Duderiza
20
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 4th Sep 2003 23:01
When I want to export the highscore, it says the file already exsists. How can you keep writing to a file without it stating that th file already exists. Also the highscore is set to 300 in the high score variable. When the score breaks the highscore, it still exports the old highscore. I hope someone can help me and tell me what's wrong. Its probably something easy but I'm newish to DB.

Thanx
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 4th Sep 2003 23:27
Just add the following line before the OPEN TO WRITE

if file exist(FILENAME) then delete file FILENAME

... substitute FILENAME with the filename you are opening of course
Duderiza
20
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 5th Sep 2003 22:15
If I wanted to read from the file, i'd put open to read 1,highscore.dat then if file exist(highscore.dat) then delete file(highscore.dat)???
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 6th Sep 2003 02:10
Um, no. Why would you want to delete the file you want to read?

Just put the line before an OPEN TO WRITE command.

Login to post a reply

Server time is: 2024-03-01 04:17:26
Your offset time is: 2024-03-01 04:17:26