writting to C:\

I have a problem with missing rights. I just can't create files on C:\. Folders somehow are no problem, but files don't work.
I already tried to run the .exe as an admin, which didn't help.

If anyone knows how to do this, please let me know.
You can approach the problems in two ways.

1. Take a look at the permissions at C:\ and see if you have access.

2. Use native WIN32 calls (like CreateFile()), and check your return codes.

You should be able to grant yourself access if you have admin priviledges. However, C:\ is locked down for a reason.
Can you also show us a little example? All I can say is that Also I had problems with C:, but solved them running the program as admin, thing that doesn't look like it helped you.
to be precise i want to copy files to C:\

I'm not at the right pc at the moment, so i can't provide you with code, but so far i tried the following

http://msdn.microsoft.com/en-us/library/windows/desktop/aa363851%28v=vs.85%29.aspx
http://doc.qt.digia.com/4.6/qfile.html#copy-2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <fstream>
#include <string>
#include <iostream>
using namespace std;
int main()
{

// copy file
     std::ifstream  src("out.txt");
     std::ofstream  dst("c:\\out.txt");
     dst << src.rdbuf();

    return 0;
}



Last edited on
does this always work or might i get some problems with it?
You need elevated privileges to create files on C:\ drive (or whatever is your windows drive).
so this is not a programming issue. it's simply a problem of missing rights?
how can we know until we see your code ?
i was asking in general. but if that's your answer, then it is a programming issue.
you didn't give us enough info to know if it is or not.
Topic archived. No new replies allowed.