Get path to file found by FindFirstFile

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Dec 2008
Posts: 2
Reputation: praetorian20 is an unknown quantity at this point 
Solved Threads: 0
praetorian20 praetorian20 is offline Offline
Newbie Poster

Get path to file found by FindFirstFile

 
0
  #1
Dec 10th, 2008
Hi,
I'm using FindFirstFile and FindNextFile functions to get a list of
files from a path specified by the user.

Let's say the current directory has a sub-directory named 'subDir1'
which has a file named 'file1.txt'.

myDir <- pwd
|_ subDir1
|_ file1.txt

Now, if the user enters 'subDir1\*' as the input argument I know how
to use FindFirstFile and FindNextFile to get 'file1.txt' but I also
need to be able to retrieve the path to 'file1.txt', either absolute
or relative to the current directory. Is there any way to do this?

Thanks for your help in advance,
Ashish.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,442
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1474
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Get path to file found by FindFirstFile

 
0
  #2
Dec 10th, 2008
>> Is there any way to do this?

check the user input string to see if it contains a path -- e.g. the '\' or '/' character (path separators can be either character in MS-Windows os). Copy that part in another string so that you can use it whanever needed.
Last edited by Ancient Dragon; Dec 10th, 2008 at 12:34 am.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 2
Reputation: praetorian20 is an unknown quantity at this point 
Solved Threads: 0
praetorian20 praetorian20 is offline Offline
Newbie Poster

Re: Get path to file found by FindFirstFile

 
0
  #3
Dec 10th, 2008
Originally Posted by Ancient Dragon View Post
>> Is there any way to do this?

check the user input string to see if it contains a path -- e.g. the '\' or '/' character (path separators can be either character in MS-Windows os). Copy that part in another string so that you can use it whanever needed.
Thanks Dragon, that works!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC