Hello,

I am so frustrated as I search the internet and cannot find solution for what I want to do...

I want my C or C++ code be able to create a file in a directory under "C:\Program Files", for example "C:\Program Files\abc\xyz.txt". This usually triggers a security confirmation like "You need to provide administrator permission..." when you do it manually on Windows vista/7. I don't mind if this attempt requires a confirmation from user to continue.

I've tried FileIOPermission with no luck. Please help me if you know the resolution. Thank you very much

Linx

Code please? We can't really help much without seeing your attempt at it.

N.B.: I hope you are aware that in C/C++ you cannot write a file-path as "C:\Program Files\my\path\file.txt", because the slash "\" character is an escape character. To actually get the "\" character, you need to write "\\" instead, as so: "C:\\Program Files\\my\\path\\file.txt".

I need to create a license file (text file) in the same directory (C:\Program Files\VendorName\SoftwareName\SoftwareName.lic") as the executable. The license file will be created only once the first time user launch the program.

Because the license file is supposed to be shared among multiple users on the computer, it makes sense to make it sit in a "centralized" directory.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.