Thread: Actions of CreateDirectory

  1. #1
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138

    Actions of CreateDirectory

    What happens with CreateDirectory if the directory already exists? Also, how can you check if a directory exists?

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: Actions of CreateDirectory

    Originally posted by golfinguy4
    What happens with CreateDirectory if the directory already exists?
    The function returns 0 and GetLastError equates to ERROR_ALREADY_EXISTS

    Originally posted by golfinguy4

    Also, how can you check if a directory exists?

    Try the above?

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    You can also browse the parent directory with FindFirstFile()/FindNextFile(), it will also report directories, (check the file attributes field, directories have FILE_ATTRIBUTE_DIRECTORY set).
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Thanx Fordy and adrianxw, that was exactly what I was looking for.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linux equivalent to CreateDirectory
    By Rak'kar in forum Linux Programming
    Replies: 2
    Last Post: 07-10-2004, 12:04 PM
  2. Unit Actions
    By DavidP in forum Game Programming
    Replies: 20
    Last Post: 05-28-2004, 09:18 PM
  3. 2 actions at once
    By Chobo_C++ in forum C++ Programming
    Replies: 16
    Last Post: 04-26-2004, 06:28 AM
  4. monitoring user actions
    By CodeMonkey in forum Windows Programming
    Replies: 2
    Last Post: 11-27-2003, 05:18 AM