Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6083987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:28:05+00:00 2026-05-23T11:28:05+00:00

#include <iostream> #include <direct.h> using namespace std; int main() { if( _mkdir(d:\\a\\b) == 0

  • 0
#include <iostream>
#include <direct.h>
using namespace std;
int main() {
 if( _mkdir("d:\\a\\b") == 0 ){
   cout << "success";
 }    else if (  _mkdir("d:\\a") == EEXIST ) {
   cout << "Directory was not created because dirname is the name of an existing   file, directory, or device.";
      }
         else if (  _mkdir("d:\\a") == ENOENT ) {
      cout << "Path was not found.";
    }
}

On running the program the output is unexpected.(Most of the times it is a fail. I don’t know the reason)

sometimes i see success.Many times i if i remove double slash \\ with single slash \ the message is success .
This thing is making me furious. Why is this happening ?
Are backslashes the problem ?

UPDATE

in visual c++ 2010 express edition when i press CTRL+F5 the output is only press any key to continue…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T11:28:05+00:00Added an answer on May 23, 2026 at 11:28 am

    The double slashes are correct. Check the error number to find out why it is failing:

    Each of these functions returns the value 0 if the new directory was created. On an error the function returns –1 and sets errno as follows:
    EEXIST – Directory was not created because dirname is the name of an existing file, directory, or device.
    ENOENT – Path was not found.

    Note that:

    _mkdir can create only one new directory per call, so only the last component of dirname can name a new directory.

    Likely causes:

    • you are trying to create both a and b with the same call (use e.g. SHCreateDirectoryEx() instead)
    • the directory already exists
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#include <iostream> using namespace std; int main() { double u = 0; double w
#include <iostream> #include <vector> using namespace std; int main() { vector< vector<int> > dp(50000,
#include iostream #include string using namespace std; #define AA(bb) \ string(::##bb); int main (int
#include <iostream> #include <fstream> #include <string> using namespace std; int main() { locale system();
#include<iostream> using namespace std; class A { int a; int b; public: void eat()
#include <iostream> using namespace std; class Base { public: Base(){cout <<Base<<endl;} virtual ~Base(){cout<<~Base<<endl;} virtual
#include <iostream> #include <string> #include <fstream> using namespace std ; string strWord( int index
#include <iostream> using namespace std; class Imp { public: int X(int) {return 50;} int
#include <iostream> #include <vector> #include <iterator> using namespace std; struct Point { int x;
#include <iostream> #include <stdlib.h> #include <time.h> using namespace std; int twoify(int num, int times)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.