如何根据文件名获取文件路径。 [英] How to get the file path based on file name.
本文介绍了如何根据文件名获取文件路径。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何根据C ++或MFC中的文件名获取完整文件路径
Ex。我有基于此文件名的文件名txtone.txt我需要获取完整路径
,如果它在D:\ folder1 \ folder2 \ txtone.txt
解决方案
您可以做的最好的事情是递归搜索这样的文件。然后你将处理(可能)多个结果。例如,请参阅此Stack Overflow问题:使用C ++ MFC进行递归文件搜索? [ ^ ]。
How to get the full file path based on the file name in the C++ or MFC
Ex. i have file name txtone.txt based on this file name i need to get the fullpath
like if it is in D:\folder1\folder2\txtone.txt
解决方案
The best you can do is recursively search for such a file. Then you are going to deal with (possibly) multiple results. See for instance this Stack Overflow question: "Recursive file search using C++ MFC?"[^].
这篇关于如何根据文件名获取文件路径。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文