Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Search

Status
Not open for further replies.

judyscofield

Programmer
Sep 24, 2001
56
0
0
US
I've been asked to add a routine in an existing application that searches for a file on the user's machine, then edit that file if it is found. It happens to be an ini file.

I know that locfile() finds a file, but only searches in the paths set in set path. How can I search for a file if I don't know what subdirectory it is located in on the user's machine? Also, what if there might be multiple occurances of the file on the machine? How can I find all of them?

Once located, how do I edit the file within my program. It's a very specific edit on one line of the file. If I use at() or atc() how do I specify the string that I'm searching in?

Thanks.

Judy Scofield
 
judyscofield

Try adapting faq184-140
FAQ184-2483 - the answer to getting answered.​
Chris [pc2]
 
afternoon

i had to do the same thing except with just the 1st occurrence of the ini file

try this


its a VCX class I made from a prg i found (apologies to the original author - but i lost the original documentation) which searches for a file and returns the path

the code foir using it is..

cInipath=.frmPassword.filesearch1.search("MPW32.INI",1,"Locating... ",.T.,.F.)


i've also got the edit code some place - basically it was a fread - low level file access

hope its ok & the link works because i'm going home now.

monkey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top