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.

Geek Culture / PureBasic Scripting Problem

Author
Message
pigs can fly
18
Years of Service
User Offline
Joined: 20th Aug 2006
Location: Luxembourg
Posted: 12th Sep 2007 00:41
Is anyone using PureBasic (demo or full version)?
I'm actually working on a little program made in it and I have a little problem:

I wanted the program to show up a window with several buttons where you can choose from a few functions. The window and the buttons work, but I wanted the program to open a pre-defined TXT file and only change (specified by the button functions) one numeric value of one certain line and save all the new settings.

So I want to ask: Can anyone tell me how to change one little value in a TEXT file?

Any help would be greatly appreciated
Thanks in advance!

PCF Killer&Slaughter Machines Pack in progress
AMD Sempron 2,0Ghz - Windows XP Home - ATI All-in-Wonder X800XT 256mb - 1024mb RAM - using Photoshop and Milkshape
pigs_can_fly.hot.lu/pcf
OSX Using Happy Dude
21
Years of Service
User Offline
Joined: 21st Aug 2003
Location: At home
Posted: 12th Sep 2007 01:04 Edited at: 12th Sep 2007 01:07
What you would have to do is read the complete file into memory, find the appropriate line & value and change it and re-save everything.

It may be worth writing a routine that reads in text lines in the format :

<key>=<value>

It would then be easy to change on thing, although you would always have to re-write the complete file, unless...

Its binary data, whereby you could just change the file pointer and update the data there.

Visit my web site for real bangin' stuff at http://www.nicholaskingsley.co.uk
pigs can fly
18
Years of Service
User Offline
Joined: 20th Aug 2006
Location: Luxembourg
Posted: 12th Sep 2007 01:14
Thanks, I'll try

PCF Killer&Slaughter Machines Pack in progress
AMD Sempron 2,0Ghz - Windows XP Home - ATI All-in-Wonder X800XT 256mb - 1024mb RAM - using Photoshop and Milkshape
pigs_can_fly.hot.lu/pcf

Login to post a reply

Server time is: 2024-11-19 05:35:59
Your offset time is: 2024-11-19 05:35:59