943,625 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 1732
  • C++ RSS
Dec 10th, 2008
0

Get path to file found by FindFirstFile

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
praetorian20 is offline Offline
2 posts
since Dec 2008
Dec 10th, 2008
0

Re: Get path to file found by FindFirstFile

>> 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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2282
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,947 posts
since Aug 2005
Dec 10th, 2008
0

Re: Get path to file found by FindFirstFile

>> 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!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
praetorian20 is offline Offline
2 posts
since Dec 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Making a GUI in Unix?
Next Thread in C++ Forum Timeline: Assertion Failure???





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC