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 / I wrote this Function But it isn't working, WHY ??

Author
Message
SeNsE
21
Years of Service
User Offline
Joined: 26th Nov 2002
Location:
Posted: 27th Nov 2002 14:39
input Search$
Search_Data("Data_",".txt")

Function Search_Data(File$,Ext$)
Numb$="000"
Look$=File$+Numb$+Ext$
Find First
repeat
Numb$="Numb$+1"
Open to read 1,Look$
Until Search$=Title$
endfunction

This function is supposed to load an file with the name Data_001.txt, search it for the Title$ string and if it dosn't contain it, it will move on and search the next file ect...
But i don't know why it isn't working (?).
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 27th Nov 2002 16:21
Well there are a lot of things wrong in this code. I assume you're using DB 1.x?
- Variables in DB are not global (in DBpro they can be global)
- so you have Numb$ = "000" and then later Numb$ = "Numb$+1". So the variable Numb$ contains the string "Numb$+1".
- Find First results can be accessed by Get File Name$(). By the way in your case file exist() would be better.
- the Variable Title$ in you function contains nothing at all.

I will write you a snippet but need answers to the following questions:
What DB version do you use?
Are there going to be more files than Data_001.txt? For example Data_029.txt, Data_143.txt and so on?

Ogres have layers.
SeNsE
21
Years of Service
User Offline
Joined: 26th Nov 2002
Location:
Posted: 28th Nov 2002 07:43
yes there will be several files to look/search through

TheCyborg
22
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Denmark
Posted: 28th Nov 2002 12:07
Look at this place.

http://www.darkbasicpro.com/apollo/view.php?t=2615&b=10

BTW It's not smart to "double post".

TheCyborg Development.
http://TheCyborg.Amok.dk
The Ultimate Source To DarkBASIC Programming.
Mirthin
22
Years of Service
User Offline
Joined: 13th Oct 2002
Location: Land of the Rising Haggis
Posted: 28th Nov 2002 18:20
Yeah, in some places it's known as "spam."

Who wants cake? I've got a little slice of hell for everyone.

Login to post a reply

Server time is: 2024-11-23 18:20:41
Your offset time is: 2024-11-23 18:20:41