Opening file using fstream on XP Guest Account

Started by
1 comment, last by Codeka 15 years, 4 months ago
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]
-=~''^''~=-.,_Wicked_,.-=~''^''~=-
Advertisement
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.
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.

This topic is closed to new replies.

Advertisement