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.

Recommended Answers

All 2 Replies

>> 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.

>> 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!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.