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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:13:51+00:00 2026-05-19T10:13:51+00:00

Whenever I try to create a file using fopen, fopen acts as if the

  • 0

Whenever I try to create a file using fopen, fopen acts as if the file has been opened properly and that it has full access to it, but it doesn’t actually create the file. My program doesn’t have write access to the system root folder because it needs admin access to write there, but why isn’t fopen() giving any errors?

Any idea how to tell if there’s an error or not? The file handle that gets returned when I’m trying to open the file in a protected directory is exactly the same as when I open a file in a directory where I have write access.

I’ve tried this with the various different versions of fopen (fopen, _wfopen, _wfopen_s) but they all have the same output.

Interestingly enough, GetLastError() returns ERROR_ALREADY_EXISTS.

Here’s the code that I’m using:

FILE *FileHandle; 
DWORD error = _wfopen_s(&FileHandle, L"\\filename.txt", L"a");
Win32Error = GetLastError();

if (error != 0 || FileHandle == NULL)
{
    //Throw error
}
else 
{
    //write to file
    //close file
}

EDIT: As rerun pointed out, the file is getting created in %APPDATA% because of virtualization. Does anyone know how to disable this feature?

  • 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-19T10:13:52+00:00Added an answer on May 19, 2026 at 10:13 am

    This might have to do with the virtual store. Take a look here for some info.

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

Sidebar

Related Questions

I'm using ASP.Net and whenever I create a script file or try to include
Whenever I try to copy an entire working copy using simple drag and drop
I'm new to python, and I've been reading that using global to pass variables
Whenever I try to add a new project to my SourceSafe repository it creates
Whenever I try to install a Click Once application, I always get a 404
Whenever I try to write graphical programs (whether a game or really any GUI
whenever I try to run something in Java, Eclipse changes into the PHP perspective.
I get the above error whenever I try and use ActionLink ? I've only
Why in Windows, can't you name a folder 'con'? Whenever I try to name
I'm trying create a ASMX webservice that can perform a HTTP GET request. I

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.