FindFirstFile broke on vista?
I have code using FindFirstFile. I am positive it worked fine on XP. On vista it does not work. I then thought maybe i can only enumerate files in user profile so i decided to enumerator my desktop. No luck either. The string i use is c:/my/path/desktop/*, i tried backslashes too, no luck.
Is there anything i need to do to be allowed to use FindFirstFile on vista?
Assuming it works like _findfirst(), then you may need to tell it to find '*.*', not just '*'. That's just a guess though, since, as the other guys mentioned, we need a little more information before we can tell what the real problem is.
Firstly it does need to be blackslashes, not forward-slashes. Then secondly, because the backslash is the escape character within strings in C & C++, you need to have two of them for each backslash you want in the string.[smile]
If that wasn't the problem, please post actual code.
If that wasn't the problem, please post actual code.
i figured it out. I accidentally left the project in unicode mode. I was passing a char* and i received no error or warning :x and i didnt typecast either.
How could i not get an error like that :X. What tipped me off was GetCurrentDirectory was only giving me the letter 't' and that happened to be the drive letter of my dev partition.
How could i not get an error like that :X. What tipped me off was GetCurrentDirectory was only giving me the letter 't' and that happened to be the drive letter of my dev partition.
Quote:Original post by iMalc
Firstly it does need to be blackslashes, not forward-slashes.
Are you sure about this or is this a Vista only requirement? The docs show no such requirement and I have been able to use forward slashes on a none Vista OS in the past.
Quote:Original post by dmailIt's not listed as a requirement in the documentation for FindFirstFile because it's described in the guidelines for Naming a File or Directory in Windows, which FindFirstFile naturally relies on. Note that (as mentioned in the linked document) "File I/O functions in the Windows API convert "/" to "\" as part of converting the name to an NT-style name, except when using the "\\?\" prefix as detailed in the following sections."Quote:Original post by iMalc
Firstly it does need to be blackslashes, not forward-slashes.
Are you sure about this or is this a Vista only requirement? The docs show no such requirement and I have been able to use forward slashes on a none Vista OS in the past.
Oops my bad. Still I would never recommend intentionally using forward-slashes.
Glad you solved the issue.
Glad you solved the issue.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement