none
How to create a new folder with C++ code

    Question

  • Hi

    I wonder, how can i create the folder c:\ZigBeeLogs\ if it don't exists yet, with a c++ code? I guess this task may  be like "piece of cake" for an experienced programmer.

    Best regards Bjørn Liene Gundersen

    Monday, March 26, 2007 5:59 PM

Answers

  • MSDN is your friend. In future similar cases, try searching for "create directory".

    _tmkdir(_T("c:\\ZigBeeLogs");
    Monday, March 26, 2007 6:22 PM
  • Of course, you also have the option of using the Windows API: CreateDirectory() or CreateDirectoryEx().
    Monday, March 26, 2007 6:36 PM

All replies

  • MSDN is your friend. In future similar cases, try searching for "create directory".

    _tmkdir(_T("c:\\ZigBeeLogs");
    Monday, March 26, 2007 6:22 PM
  • Of course, you also have the option of using the Windows API: CreateDirectory() or CreateDirectoryEx().
    Monday, March 26, 2007 6:36 PM
  •  

    Thanks. It worked. I was searching for "create folder" at the MSDN library, and of course i should have searched "create directory", so for that reason I couldn't find it:-)

     

    Thanks anyway.

     

    Bjørn Liene Gundersen

    Monday, March 26, 2007 10:51 PM
  • In addition to Bancila's comment, Create Directory will only create the directory specified at the end of the path specified. If any of the intermediate directories not existing, the API will fail.

     

    You can use or SHCreateDirectory or SHCreateDirectoryEx API to create Intermediate directories if they're not existing. This is documented in MSDN.

    • Proposed as answer by Chaker Nakhli Friday, January 02, 2009 10:30 AM
    Tuesday, March 27, 2007 3:52 AM
  • Could u pls provide some piece of codes using the  Create Directory
    I m unable to create
    Friday, January 02, 2009 4:40 AM
  • CreateDirectory("c:\\dir1\\dir2\\ ... \\dirn", NULL);

    Just don't forget to use "\\" for each "\" in the path
    Sunday, January 04, 2009 6:40 PM
  • Thanks for ur reply,
    I ve used the same code earlier too but the folder is ot getting created.
    I m using windows mobile SDK 6.0 with VC 2005
    Is it a constraint that i m running my code in emulator not in device, will it create folder in emulator??

    Thanks in advance
    Tuesday, January 06, 2009 3:03 AM
  • Hi
    Thanks a lot, i m able to create folder now..
    Please help me to open the folder from my application..

    Thanks in advance
    Tuesday, January 06, 2009 10:26 AM
  • You should read this
    Thursday, January 08, 2009 10:03 AM