Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFileFind::FindFile

Status
Not open for further replies.

Warrioruw

Programmer
Jan 30, 2004
24
0
0
CA
Hi all,

I wonder why FindFile returns true when I pass a file directory path like "C:\Programs\\New Folder".

By the way, for the definition of directory path, someone prefers the path with back slash '\' at the end, but someone prefers no '\' at the end. The reasons are:

With '\', it is clearly indicated it is a directory path, not a file name.
Without '\', it is used by Windows Explorer, and Dos command.

I like the second opinion, but my boss likes the first, so I have to change everything back to meet his favor. That's why there are two slashes in "C:\Programs\\New Folder".

Any ideas?

Thanks.
 
> That's why there are two slashes in "C:\Programs\\New Folder".
There are two slashes because that's the rule in C and C++, it's nothing to do with your file name conventions. \P probably does nothing special on your compiler, but its not wise to rely on it. You've written \\N, because \N is actually already special in C and C++.

So really, it ought to be
[tt]"C:\\Programs\\New Folder"[/tt]

Whether you then decide to make it
[tt]"C:\\Programs\\New Folder\\" // append a trailing backslash[/tt]
Is upto your local conventions I imagine.

--
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top