| | |
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:
Solved Threads: 0
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.
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.
>> 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.
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.
![]() |
Similar Threads
- Browsing through files in folders, the compare (C++)
- Iterator assertion failure. How? (C++)
- Neophyte requests assistance... (C++)
- FindFirstFile & FindNextFile return extra files? (C++)
Other Threads in the C++ Forum
- Previous Thread: Making a GUI in Unix?
- Next Thread: Assertion Failure???
| Thread Tools | Search this Thread |
api array arrays based binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






