mkdir() Directory already exists?

This is a discussion on mkdir() Directory already exists? within the C Programming forums, part of the General Programming Boards category; Hi, I'm using mkdir() to create new directories. I ask the user for a directory name, but it's very important ...

  1. #1
    1ST » R. vd Kooij
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    154

    mkdir() Directory already exists?

    Hi,

    I'm using mkdir() to create new directories. I ask the user for a directory name, but it's very important to check whether the directory already exists, because the data in it shouldn't be overwritten.
    Any idea how to do this?

    Thanks in advance,

    René
    http://www.f1rstracing.nl/
    OS: Windows XP
    Compiler: Dev-C++

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    _stat() or stat() will probably tell you whether a directory already exists or not.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 10:38 AM
  2. Couple errors please help :-D
    By JJJIrish05 in forum C Programming
    Replies: 9
    Last Post: 03-06-2008, 02:54 AM
  3. Replies: 1
    Last Post: 12-10-2007, 06:26 PM
  4. MFC: How do you check if a directory exists before creating?
    By BrianK in forum Windows Programming
    Replies: 5
    Last Post: 07-06-2004, 02:09 AM
  5. Replies: 6
    Last Post: 07-30-2003, 04:08 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21