CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Jul 2006
    Posts
    49

    CreateDirectory function

    Hi all,
    I have some question for using CreateDirectory, the question is that whe I want to create directory by using CreateDirectory shch as
    Code:
    CreateDirectory(L"XXX", NULL);
    DWORD res = GetLastError();
    the return value from GetLastError function tell me that I can create "XXX" directory successfully but I can not find "XXX" directory. Could everyone tell me that where it created?

    Thnak very much

  2. #2
    Join Date
    Feb 2002
    Posts
    3,788

    Re: CreateDirectory function

    Quote Originally Posted by suntonphon View Post
    Hi all,
    I have some question for using CreateDirectory, the question is that whe I want to create directory by using CreateDirectory shch as
    Code:
    CreateDirectory(L"XXX", NULL);
    DWORD res = GetLastError();
    the return value from GetLastError function tell me that I can create "XXX" directory successfully but I can not find "XXX" directory. Could everyone tell me that where it created?

    Thnak very much
    so i don't understand why aren't you designating the full path yourself. something like: L"C:\\Temp\\TestDir\\"

  3. #3
    Join Date
    Jul 2006
    Posts
    49

    Re: CreateDirectory function

    Hi Alin
    Thank you for your reply
    The path is get from user.

  4. #4
    Join Date
    Jan 2002
    Location
    Houston, TX
    Posts
    1,421

    Re: CreateDirectory function

    Unless you're using the full path name as Alin mentioned, the XXX directory will be created under the CURRENT working directory - which could possibly be anywhere...

    If you start your program withing Visual Studio, at the beginning, the current working directory will be the directory containing your .sln/.vcproj files. However, if you browse for a file from within your program, the current directory may change to the folder containing the file you selected in the browse dialog.

    If you run the program by double clicking on the executable (from Window Explorer), the current directory will be the folder containing the executable.

    If you run the program from a desktop shortcut, the working directory will be whatever the shortcut says it should be.

    THEREFORE - you really should use a full path name.

    Hope that helps.
    Be sure to rate those who help!
    -------------------------------------------------------------
    Karl - WK5M
    PP-ASEL-IA (N43CS)
    PGP Key: 0xDB02E193
    PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193

  5. #5
    Join Date
    Jul 2006
    Posts
    49

    Urgent CreateDirectory issue

    Hi all,
    Again with CreateDirectory function, I would like to ask all of you that how can I force CreateDirectory function to not create directory in CURRENT working directory?
    Thank you very much and sorry for making bord dirty.

  6. #6
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,637

    Re: Urgent CreateDirectory issue

    That question was answered in your other thread asking the same thing. Supply the full path.

  7. #7
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: CreateDirectory function

    [ Merged threads ]
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured