#include<windows.h>
#include<stdio.h>
#include<conio.h>

int main()
{
  system("mkdir c:\\Imp"); 
 getch();
}

How to check this Imp folder exists or not??
if exists not creating again??

I recommend not to use system(). What is someone makes a program called 'mkdir' that formats your HD? That would be quite a bummer.

Now for a solution:

Linux

#include <sys/stat.h>

mkdir (const char *path, mode_t mode);

in this case mode = O_CREAT. Function returns an int (0 on success)

Windows

#include <windows.h>

CreateDirectory (char *DirName, SECURITY_ATTRIBUTES Attribs);

If the function succeeds returns non-zero else NULL.

What aren't you 'getting'?
What OS are you using? The code you posted is a strange blend of linux/windows...

Since you appear to be on Windows,

Because he included <windows.h> I sort of agree with you, but 'mkdir' is pure linux, so that's why I asked to make sure :)

one way is to use GetFileAttributes(), see
http://msdn.microsoft.com/en-us/library/aa364944.aspx

To check if the dir exists: yes. But the OP wants to create a dir, so CreateDirectory (char *DirName, SECURITY_ATTRIBUTES Attribs); would be the way to go.

Example:

#include <windows.h>
#include <iostream>
[...]
if (!CreateDirectory("c:\\mydir", NULL)) 
   std::cout << "Creating failed"; 
else
    std::cout << "Success!";

Nope, Windows recognizes mkdir as well ;)

You're right! Never knew that...
I'm from the Dos-age: md this and rd that. :)

This question has already been answered. Start a new discussion instead.