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 7879497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:54:28+00:00 2026-06-03T03:54:28+00:00

I am using the code example shown in post 592448 to try grant full

  • 0

I am using the code example shown in post 592448 to try grant full file permisison. When I compile the code snippet using:

 gcc -shared -mno-cygwin -Wall -o native.dll native.c

I get below error:

native.c:8: error: conflicting types for 'mode_t'
/usr/i686-pc-mingw32/sys-root/mingw/include/sys/types.h:99: error: previous declaration of 'mode_t' was here
native.c:21: error: parse error before numeric constant
native.c:22: error: parse error before numeric constant
native.c:23: error: parse error before numeric constant
native.c:25: error: parse error before "mode_t"
native.c:26: error: parse error before "mode_t"
native.c:28: error: parse error before "mode_t"
native.c:29: error: parse error before "mode_t"

I stripped the code down to reduce to below, which compiles fine but do not seem to change the file permission as required.

#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>

#ifdef _WIN32
#   include <io.h>

typedef signed int md_t;
static const md_t MS_MODE_MASK = 0x0000ffff;           ///< low word

int fchmod(const char * path, md_t mode)
{
    int result = _chmod(path, (mode & MS_MODE_MASK));

    if (result != 0)
    {
        result = errno;
    }

    return (result);
}
#else
int fchmod(const char * path, md_t mode)
{
    int result = chmod(path, mode);

    if (result != 0)
    {
        result = errno;
    }

    return (result);
}
#endif

Any pointers on how to get this working?

  • 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-03T03:54:29+00:00Added an answer on June 3, 2026 at 3:54 am

    Note that on windows all this can do is set the file to readonly or not, Windows file permissions are different from UNIX type file permissions.

    If this is all you want to do: in what way is it not working?

    EDIT: regarding the initial error you had mode_t defined elsewhere: /usr/i686-pc-mingw32/sys-root/mingw/include/sys/types.h:99 and tried to redefine it as typedef int mode_t;

    from MSDN:

    If write permission is not given, the file is read-only. Note that all files are always readable; it is not possible to give write-only permission. Thus the modes _S_IWRITE and _S_IREAD | _S_IWRITE are equivalent.

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

Sidebar

Related Questions

Im using the color picker here: http://blog.meta100.com/post/600571131/mcolorpicker Im using code shown in example 3.
Using the code example on the Twitterizer website I am trying to post a
The example below shows the code I am using to test whether a user
I saw this C# using statement in a code example: using StringFormat=System.Drawing.StringFormat; What's that
So, I need to write an example code using the decorator dessign pattern and
Using the example code included in the man page for DateTime::Astro::Sunrise , I'm getting
Please forgive the verbosity of the following code example. Using Delphi 2009, I created
I need to plot multiple sphere and I was using the example code from
How do I pass input into the command line using code. For example, I
This is the example code, I'm using these functions for a program, but scanf

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.