Jump to content
  • Advertisement
Sign in to follow this  
BennettSteele

fstream starting location (from environment to C:\\)

This topic is 2539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to test if the user is using a mom-administrative account, like at school, and i need to test if a sensitive area (like C:\\system\) kind of directory is write-able to. i have looked around, and this seams to be the best method. now that i know what im going to do, i need to know how to use fstream from the directory C:\\ instead of where the application directory is. what do i need to do?

Share this post


Link to post
Share on other sites
Advertisement
You'll just need to provide a full path instead of a relative path, the OS should take care of the rest smile.png

'system32' will look in the directory of your application
'C:/system32' wont look in the directory of your application

P.S Yes, you can use / instead of \\ to describe a path in Windows D.S Edited by Deprecated

Share this post


Link to post
Share on other sites
Thanks! it works, but for some reason i cant write to the C:/Windows/System32 directory...
As in, i can see the file in "C:/" but not in "C:/Windows/System32/"

Share this post


Link to post
Share on other sites
You need to run the application as an admin to access system32. If you open explorer and attempts to access those directories you should get a UAC confirmation box - which means that you're actually accessing the data with permission from the admin.

If you run the application as admin (right click, preferences, ..., run as admin) it should work. You should also be able to request those permissions from the system.

Share this post


Link to post
Share on other sites
XD well for my game, i usually show people at school. it has some reaslistic 2D images of guns... XD
When i was trying to download OpenAL, i saw that you cant access a specific folder... so thats how i thought of it.

I dont think i will be using this though, but its good for other things. ;P

Share this post


Link to post
Share on other sites
I don't understand. What does being an administrator do with using OpenAL?

If you did need to do an administrative task to run the game, the normal solution is to provide an installer that can be run as an administrator if necessary. But do check if it is actually necessary, it is really bad to try to put shit into the user's system directories. Just think, what if two programs try this, but disagree on the contents of the file they are writing?

Share this post


Link to post
Share on other sites
I agree that for a game you should not need administrative rights. When it runs on a windows platform you can use the Windows API to query standard directories where you can write the save games, etc. and where the system32 and program files directories are. I am pretty sure that Linux has similar methods. As Rip-off mentioned for an installer it is allowed to ask for admin rights if you install to for example the program files directory.

So, better try not to use it: users don't like the boxes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!