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 / Reading From Files...

Author
Message
Deleted
20
Years of Service
User Offline
Joined: 26th May 2004
Location:
Posted: 21st Aug 2004 06:06
I need my program to search for a certain string in a text file (i.e. AreaName: or AreaXSize and then read the following piece of data (i.e. Town or 2500) and use those pieces of data as the values of variables in my program.
I don't really know where to begin with this... any help would be much appreciated

Totally
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 21st Aug 2004 06:21
well, to begin, you need to open a file thats pretty simple



then you would need to search the file for strings. I do not want to spoil you fun so you can work this bit out.(I cant b bothered)

then you have to store the data afterwards, possibly in variables of the same Name inside your program.(DIY)

then you have to close the file (again,i can't b bothered but this bits easy) hope this helps you to do what you want
Deleted
20
Years of Service
User Offline
Joined: 26th May 2004
Location:
Posted: 21st Aug 2004 06:29
Actually, You Told Me The Only Bit I Knew. Darn... But Thanks For The Help Anyway. ^-^

Totally
Dodo
20
Years of Service
User Offline
Joined: 8th Aug 2004
Location: eating lunch
Posted: 21st Aug 2004 06:35
Ill post the rest of the code when i get back from holiday (in a week) but for now i think ill just sleep zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
Deleted
20
Years of Service
User Offline
Joined: 26th May 2004
Location:
Posted: 21st Aug 2004 06:39


Why doesn't this work?
The file I wish to read is called town.txt and the first letter in the file is V

Totally
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 21st Aug 2004 08:27
check out the string and file functions in our plugin below.
Look for fil_GetFileToString(), and str_Instr()

you can read the docs without downloading the plugin


DBP_NETLIB_v1.4.3 - 65 FREE Functions * Click Logo
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 21st Aug 2004 08:34
You proberly want to do something like this.



READ STRING will read until a new line or the end of the file.

What exactly does town.txt look like?

shrink those dbpro exes
Create patches for your dbpro games

Login to post a reply

Server time is: 2024-11-27 06:38:31
Your offset time is: 2024-11-27 06:38:31