Click here to Skip to main content
15,889,714 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Client /Server architchture Pin
Renjith Ramachandran26-May-06 1:54
Renjith Ramachandran26-May-06 1:54 
AnswerRe: Client /Server architchture Pin
valikac26-May-06 6:36
valikac26-May-06 6:36 
Questionhow to convert CString to const WCHAR * Pin
NoName II25-May-06 23:59
NoName II25-May-06 23:59 
AnswerRe: how to convert CString to const WCHAR * Pin
VinayCool26-May-06 0:24
VinayCool26-May-06 0:24 
AnswerRe: how to convert CString to const WCHAR * Pin
Nibu babu thomas26-May-06 0:25
Nibu babu thomas26-May-06 0:25 
AnswerRe: how to convert CString to const WCHAR * Pin
Hamid_RT26-May-06 0:30
Hamid_RT26-May-06 0:30 
AnswerRe: how to convert CString to const WCHAR * Pin
ThatsAlok26-May-06 1:07
ThatsAlok26-May-06 1:07 
QuestionQuestions on CFileFind and CreateDirectory Pin
David L.S.25-May-06 23:57
David L.S.25-May-06 23:57 
Hi, there,

I would like to realize a function that can create a folder called "data" in a directory if it doesn't exist. Here is my code:

CString strPath ="D:\\temp";
SetCurrentDirectory(strPath);
CFileFind ff;
BOOL btmp1 = ff.FindFile("data");
if(btmp1)
{
BOOL btmp2 = ff.FindNextFile();
if(!ff.IsDirectory())
{ //*************************//
if(!CreateDirectory(LPCTSTR(strPath+"\\data"), NULL))
{
ff.Close();
return FALSE;
}
}
}
else
{
if(!CreateDirectory(LPCTSTR(strPath+"\\data"), NULL))
{
ff.Close();
return FALSE;
}
}
ff.Close();
return TRUE;

Then I noticed a strange thing. If there is a file in "D:\\temp" named data, the CreateDirectory function after //***// part always fails. Please note that the existing data is a file without extension, not a folder. So I added a line to the //***// part:
CFile::Rename(strPath+"\\data", strPath+"\\data.bak");
then the CreateDirectory function can succeed and the folder data is created. Sadly, I won't be able to change the file data.bak to data anymore because there is a folder with the same name.

How could this happen? Or is it because I missed anything ? Your help will be greatly appreciated.

David

AnswerRe: Questions on CFileFind and CreateDirectory Pin
ThatsAlok26-May-06 0:34
ThatsAlok26-May-06 0:34 
QuestionRe: Questions on CFileFind and CreateDirectory Pin
David Crow26-May-06 2:49
David Crow26-May-06 2:49 
AnswerRe: Questions on CFileFind and CreateDirectory [modified] Pin
David L.S.26-May-06 15:45
David L.S.26-May-06 15:45 
QuestionDialogbars event mapping Pin
ilgale25-May-06 23:54
ilgale25-May-06 23:54 
GeneralRe: Dialogbars event mapping Pin
Dennis Gourjii26-May-06 3:00
Dennis Gourjii26-May-06 3:00 
QuestionInitiate windows authentication Pin
Peter Weyzen25-May-06 23:30
Peter Weyzen25-May-06 23:30 
AnswerRe: Initiate windows authentication Pin
_anil_25-May-06 23:59
_anil_25-May-06 23:59 
AnswerRe: Initiate windows authentication Pin
David Crow26-May-06 2:54
David Crow26-May-06 2:54 
QuestionRe: Initiate windows authentication [modified] Pin
Peter Weyzen26-May-06 8:13
Peter Weyzen26-May-06 8:13 
AnswerRe: Initiate windows authentication [modified] Pin
David Crow26-May-06 8:21
David Crow26-May-06 8:21 
JokeRe: Initiate windows authentication [modified] Pin
Peter Weyzen26-May-06 10:41
Peter Weyzen26-May-06 10:41 
Questiondebug .lib attaching to process? Pin
mav@octaval25-May-06 22:12
mav@octaval25-May-06 22:12 
AnswerRe: debug .lib attaching to process? Pin
Milton Karimbekallil26-May-06 4:46
Milton Karimbekallil26-May-06 4:46 
Questiontooltips on edit controls Pin
big_denny_20025-May-06 22:08
big_denny_20025-May-06 22:08 
AnswerRe: tooltips on edit controls Pin
Hamid_RT25-May-06 22:23
Hamid_RT25-May-06 22:23 
GeneralRe: tooltips on edit controls Pin
big_denny_20025-May-06 22:44
big_denny_20025-May-06 22:44 
GeneralRe: tooltips on edit controls Pin
Hamid_RT25-May-06 22:53
Hamid_RT25-May-06 22:53 

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.