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.

DarkBASIC Discussion / edititing a file

Author
Message
The Wilderbeast
19
Years of Service
User Offline
Joined: 14th Nov 2005
Location: UK
Posted: 8th Jan 2006 14:05
4 my program you you can write your code, save it, run it or whatever and then load it. When you write the code i use the 'write string 1,code$' command. But how do i get it so that the user can load it and continue editing, if you use open to read 1,"code.txt" you can only read it and you can't use open to write because the file can't exist. How can i do this???

OMG It's the Wilderbeast
The Nerd
20
Years of Service
User Offline
Joined: 5th Jun 2004
Location: Denmark
Posted: 8th Jan 2006 19:56 Edited at: 8th Jan 2006 20:00
If I understand it right, you want to open an existing file, write some new content to it, then save it again right?

If so I've made a little program(attached to this post). In the folder there is a txt file called "Myfile". When you compile the project it will open this file and print what the current text in it is... Now you can write some new text then press a key.. It now save the changes to that file and end... When you open the program again, you can see that the content have changed etc...

I know this is a very basic system... But it should give you the idea

I hope it helps.

[EDIT]:

Just realized that I wrote it in DarkBasic Pro, and this is the Darkbasic classic forum...
Well there's an exe file in the download. Here you got the source code:


That code should work in DarkBasic Classic.


-The Nerd

Free Particle Engine for DarkBasic Pro:
http://forum.thegamecreators.com/?m=forum_view&t=60141&b=5

Attachments

Login to view attachments

Login to post a reply

Server time is: 2025-05-23 00:19:05
Your offset time is: 2025-05-23 00:19:05