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 / -DBP- Problem with file writting then reading -DBP-

Author
Message
Rogue Sniper
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: some place in oregon...sadly...oregon...
Posted: 13th Nov 2006 00:10
-DBP-

I'm having a problem with file a writting strings to it then reading those strings

ex.
string1$="hello"
string2$="word"

`those are just fillers...

make file "file.txt"
open file to write 1,"file.txt"
write string 1,string1$
write string 1,string2$
close file 1

wait key

open to read 1,"file.txt"
read string 1,string1$
read string 1,string2$
close file 1

wait key

and samething goes with floats

i even tried making another program just using the last half of that code and linking it to open that txt file and it still didnt read anything...

if anyone could help, that would be greatly appreciated


-DBP-

AMD Athlon 64 x2 4600MHz/~2400MHz 64-Bit , 1GB RAM at 800mhz, XFX NVIDIA PCIe GeForce 7900 GT/GTO 256 MB, Direct X 9.0c, 250GB HD space
Code Dragon
18
Years of Service
User Offline
Joined: 21st Aug 2006
Location: Everywhere
Posted: 13th Nov 2006 21:17 Edited at: 22nd Nov 2006 00:18
How do you know that it's not reading if you don't have any print statements?

Rogue Sniper
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: some place in oregon...sadly...oregon...
Posted: 14th Nov 2006 01:03
i tried using both print and text but nothing shows at all

AMD Athlon 64 x2 4600MHz/~2400MHz 64-Bit , 1GB RAM at 800mhz, XFX NVIDIA PCIe GeForce 7900 GT/GTO 256 MB, Direct X 9.0c, 250GB HD space
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 14th Nov 2006 01:25
Before a file can be written it needs to be deleted. Add this before opening a file to write:



And get rid of "make file"... both "make file" and "open to write" both require the file to not exist otherwise it won't work. So you're basically making a file right before making a file.

Rogue Sniper
18
Years of Service
User Offline
Joined: 13th Jul 2006
Location: some place in oregon...sadly...oregon...
Posted: 14th Nov 2006 01:42
thank you very much
i see what i didnt do:
deleting the file and clearing strings

that might be why it wasnt doing anything...

thank you

AMD Athlon 64 x2 4600MHz/~2400MHz 64-Bit , 1GB RAM at 800mhz, XFX NVIDIA PCIe GeForce 7900 GT/GTO 256 MB, Direct X 9.0c, 250GB HD space

Login to post a reply

Server time is: 2024-11-26 08:41:38
Your offset time is: 2024-11-26 08:41:38