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 6578201

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:44:25+00:00 2026-05-25T15:44:25+00:00

So, I just write: int fdes = open(path, O_WRONLY | O_CREAT | O_TRUNC); And

  • 0

So, I just write:

int fdes = open(path, O_WRONLY | O_CREAT | O_TRUNC);

And if the file that the path referred to doesn’t exist, this code works. But if it does, the code returns with errno 13 : Permission Denied. I never use the O_EXCL mode at all.

I have searched for the solution to this problem a long time and I am really confused. Can you explain the problem?

I use the GCC for windows(4.5.2). Your answer will be appreciated.

  • 0 0 Answers
  • 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-25T15:44:26+00:00Added an answer on May 25, 2026 at 3:44 pm
    1. If you use O_CREAT, you should supply a mode as the third argument to open().
    2. If the file does exist, you must have write permission on the file. The error indicates (strongly suggests) that the file is created without write permission. This might be a consequence of not creating it with a sensible mode.

    Note that (on Unix at least) you can create a file for writing with mode 0444 (or even 0); the permissions affect everyone else, but not the process that created the file while it uses the file descriptor that created the file.

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

Sidebar

Related Questions

I find this atrocious: std::numeric_limits<int>::max() And really wish I could just write this: int::max
WiX is great in that there is no GUI, you just write the installer
I'm trying to write (or just find an existing) PHP method that can take
This code does not seem to compile, I just need to write something to
I just realised that this program compiles and runs (gcc version 4.4.5 / Ubuntu):
This code doesn't compile: const int x = 123; const int y = x;
I'm creating a small program that saves a int value into a text file,
I have code to read in the version number from a make file. VERSION_ID=map(int,re.match(VERSION_ID\s*=\s*(\S+),open(version.mk).read()).group(1).split(.))
Hi this is a very simple piece of code I just write for C++
how can I write just a simple disassembler for linux from scratches? Are there

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.