Click here to Skip to main content
15,891,657 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Checking if a folder exists... Pin
David Crow16-Feb-05 7:41
David Crow16-Feb-05 7:41 
GeneralRe: Checking if a folder exists... Pin
ChemmieBro16-Feb-05 9:06
ChemmieBro16-Feb-05 9:06 
GeneralRe: Checking if a folder exists... Pin
David Crow17-Feb-05 3:33
David Crow17-Feb-05 3:33 
GeneralRe: Checking if a folder exists... Pin
ChemmieBro17-Feb-05 3:35
ChemmieBro17-Feb-05 3:35 
GeneralRe: Checking if a folder exists... Pin
David Crow17-Feb-05 3:55
David Crow17-Feb-05 3:55 
GeneralRe: Checking if a folder exists... Pin
Blake Miller17-Feb-05 7:59
Blake Miller17-Feb-05 7:59 
GeneralRe: Checking if a folder exists... Pin
Ryan Binns16-Feb-05 17:52
Ryan Binns16-Feb-05 17:52 
GeneralRe: Checking if a folder exists... Pin
digwizfox17-Feb-05 6:47
digwizfox17-Feb-05 6:47 
I implemented a function for something I worked on that checks to see if a file exists, but the documentation indicates that it works for directories as well as files. So take a look at this. It's worked well for me and seems very reliable. It seems different than the other responses, so if you are still looking for an alternative; here you go.

I simply created a CString as input. The CString may contain wildcard characters such as * or ?. FindFirstFile is a global method and can be found in the MSDN library so go ahead and look it up and feel free to cut and paste this function and play with it to see how it works. It's pretty simple.

BOOL CDXControlDlg::IsNewFile(CString& sPath)
{
// Check if files exists already
WIN32_FIND_DATA fileInfo;
HANDLE hFile = ::FindFirstFile(sPath, &fileInfo);
if (hFile == INVALID_HANDLE_VALUE) {
// File not found
return TRUE;
} else {
// File exists.
::FindClose(hFile);
return FALSE;
}
}

Best Regards,
Shawn
GeneralClient / Server Pin
densitet16-Feb-05 6:17
densitet16-Feb-05 6:17 
GeneralRe: Client / Server Pin
rocky_pulley16-Feb-05 8:20
rocky_pulley16-Feb-05 8:20 
GeneralRe: Client / Server Pin
densitet17-Feb-05 0:34
densitet17-Feb-05 0:34 
GeneralUnexpected printing behaviour Pin
Santanu Lahiri16-Feb-05 5:24
Santanu Lahiri16-Feb-05 5:24 
GeneralUsing CDoc variable in MainFrm Pin
jw8116-Feb-05 3:55
jw8116-Feb-05 3:55 
GeneralRe: Using CDoc variable in MainFrm Pin
Roger Allen16-Feb-05 5:04
Roger Allen16-Feb-05 5:04 
GeneralRe: Using CDoc variable in MainFrm Pin
jw8116-Feb-05 21:46
jw8116-Feb-05 21:46 
GeneralRe: Using CDoc variable in MainFrm Pin
jw8118-Feb-05 23:10
jw8118-Feb-05 23:10 
GeneralSocket + Threading Pin
cj_rahul16-Feb-05 3:43
cj_rahul16-Feb-05 3:43 
GeneralRe: Socket + Threading Pin
Anonymous16-Feb-05 6:38
Anonymous16-Feb-05 6:38 
GeneralRe: Socket + Threading Pin
Tom Wright16-Feb-05 10:26
Tom Wright16-Feb-05 10:26 
GeneralSwitching between two different views in CSplitterWnd Pin
Anonymous16-Feb-05 3:20
Anonymous16-Feb-05 3:20 
GeneralRe: Switching between two different views in CSplitterWnd Pin
Iain Clarke, Warrior Programmer16-Feb-05 5:28
Iain Clarke, Warrior Programmer16-Feb-05 5:28 
GeneralRe: Switching between two different views in CSplitterWnd Pin
bilas16-Feb-05 5:37
bilas16-Feb-05 5:37 
GeneralRe: Switching between two different views in CSplitterWnd Pin
Iain Clarke, Warrior Programmer16-Feb-05 6:24
Iain Clarke, Warrior Programmer16-Feb-05 6:24 
GeneralRetrieving data from internet Pin
Kapgan16-Feb-05 3:17
Kapgan16-Feb-05 3:17 
GeneralRe: Retrieving data from internet Pin
greba16-Feb-05 6:47
greba16-Feb-05 6:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.