Guidance
指路人
g.yi.org
Guidance Forums / Rapid-Q Basic / Problem searching dat-file

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
Message1. Problem searching dat-file
#960
Posted by: 2003-05-21 21:21:56
Hey!

Having some problems!
I?ve created a program where i write data as strings to a dat-file, and now i want to make a search-function or a sub. I want to be able to search for a specific string and have the program returning all the saved data for that string.

Is there anyone who can help me?
Message2. Re: Problem searching datfile
#962
Posted by: guidance 2003-05-22 13:19:25
Use QFileStream to read file into memory, then InStr to search: http://g.yi.org/_scripts/file.php?f=2492&r=2330
Message3. Re: Problem searching datfile
#963
Posted by: 2003-05-22 17:10:05
Hi Batteryman,

You could make an UDT with all the programs settings etc...  and write/read the UDT to/from your file.  Use the file.writeUDT and file.readUDT methods.

Or...

You could make a dat-file like this:
<parameter name1> = <data1>
<parameter name2> = <data2>
...and read it with a sub like this:

while file.position < file.size
    content = file.readline
    select case field$(content, "=", 1)
    case <parameter name1> : data1 = field$(content, "=", 2)
    case <parameter name2> : data2 = field$(content, "=", 2)
    end select
wend

Kind regards,
Alain

Forum List • Thread List • Reply • Refresh • New Topic • Search • Previous • Next First 1 Last
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Thu 2021-10-21  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0