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.

Newcomers DBPro Corner / Problems with saving data

Author
Message
saintlee
5
Years of Service
User Offline
Joined: 30th Nov 2013
Location:
Posted: 30th Nov 2013 21:10
Hi guys, just trying to write a basic file program to rearrange some data,

not used DB for a few years, currently running latest version under windows 7, data is being saved within a project folder

can't seem to get a basic file save working properly, I have tried saving and reading as write word/ write file/ write long/ write integer etc.

doesn't seem to matter what I save as, when I read back, the data has changed.. Have also tried specifying a directory to save/read to with no avail.

The results from the code below return

fx2 as 8156785(this number changes and also has a negative value sometimes”
fix= 167

any idea why fx2 isn't returning 167?


fix=167
fx1=fix
if file exist("fix1.dat")=1 then delete file "fix1.dat"
print " delete file" : wait key
make file "fix1.dat"
open to write 1,"fix1.dat"
write file 1,fx1
close file 1
print "file fix 1 written": wait key

open to read 1,"fix1.dat"
read file 1, fx
fx2=fx
close file 1
print "fixtures"," ",fx2," ",fix
wait key
LBFN
12
Years of Service
User Offline
Joined: 7th Apr 2007
Location: USA
Posted: 1st Dec 2013 15:33
I think the issue is the MAKE FILE command. TBH, I didn't realize that command even existed, as OPEN TO WRITE creates a file that you can immediately write to, and I have never had to use MAKE FILE. Also, you have a typo when you print (you read the variable into 'fx', but tell it to print 'fix'. The edited version here:



So many games to code.....so little time.
saintlee
5
Years of Service
User Offline
Joined: 30th Nov 2013
Location:
Posted: 22nd Jan 2014 00:23
thanks.

got my problem sorted, yes it was the make file command

took it out and everything was fine.
Duffer
16
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 26th Jan 2014 11:25
@ saintlee,

An opportunity to shamelessly plug my SQLITE3 plugin?

http://forum.thegamecreators.com/?m=forum_view&t=206418&b=8

You could use that to store all sorts of data...?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...

Login to post a reply

Server time is: 2019-04-25 08:16:59
Your offset time is: 2019-04-25 08:16:59