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

  • SEARCH
  • Home
  • 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 7989513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:46:23+00:00 2026-06-04T12:46:23+00:00

I implemented a solution to the problem meant to be cross-platform and adherent to

  • 0

I implemented a solution to the problem meant to be cross-platform and adherent to the C++ standard library.

bool isdir(const char *string) {
   ofstream file(string, ios::out);
   return file.fail();
}

Yet, if the file is actually writable, the program opens an empty file with string name in its working directory.
How can I prevent this from happening?

  • 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-06-04T12:46:24+00:00Added an answer on June 4, 2026 at 12:46 pm

    There is no standard way of detecting if a file is a directory in C++. But you can use Boost.Filesystem. It is well portable.

    Edit: It seems that this question has already been answered here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have my solution implemented (basic solution) and I'm happy. Problem is when I
I'm facing a dilemma (!). In a first scenario, I implemented a solution that
I've implemented WCF service using Entity Framework in a 3-Tier solution. I got it
I have a problem that I implemented a functionality in which we draw bitmaps
I have implemented a Bellman-Ford algorithm to solve a problem (with a graph), but
I'm looking for a solution for this problem in C or C++. edit :
Several months ago I implemented a solution to choose unique values from a range
I'm trying to implement a solution using .htaccess and wildcard subdomains so that http://subdomain.example.com
I'm trying to implement this accepted solution for displaying a custom error message: https://stackoverflow.com/a/5229581/141172
The company I work for is looking to implement a caching solution. We have

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.