Sign in to follow this  
Wicked Ewok

Opening file using fstream on XP Guest Account

Recommended Posts

Wicked Ewok    144
Hi there, I'm having trouble opening files using fstream/ifstream/ofstream when running my program under a windows XP Guest account. No files open, they return me empty file pointers. The program runs fine on a regular account though. Does this have anything to do with windows file permissions, and if so, does fstream provide functions to override permissions or allow me to read/write files on an XP guest account? The default SH_NODENY flag seems like it should be the most forgiving. It would really suck to have to use another library altogether all of a sudden. Edit: I just realize that only the open() calls with ios::out fails, but I would still like to be able to write out files. Any help would be much much appreciated. Thanks. [Edited by - Wicked Ewok on November 25, 2008 12:53:14 AM]

Share this post


Link to post
Share on other sites
smitty1276    560
What files are you writing, who owns the containing folder, and what permissions does the guest account have there? That should answer most of "why". :-)

To answer the "how", you may want to look at some stuff on user impersonation. That will allow you to impersonate an account that has permission to read or write the file you are dealing with, if you are in a situation where you can do that.

Share this post


Link to post
Share on other sites
Codeka    1239
By default, the Guest account on Windows doesn't have write access to anywhere (or at least, anywhere particularly interesting).

Is there any particular reason you're using the Guest account? Normally, you'd just create a regular account which you can then just grant or deny access to exactly what you want.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this