'Opening and saving file on client machine in C
I made a server/client program. Everything works fine when I run the programs on my own computer. When I run the client program on my own computer it opens and saves the text file in C:\.. However, if I run the client program(exe) on a different machine it doesn't open/save the text file in C:\.. I use C Win32. How can I successfully open a file on the client machine and save it in C:\..?
This is how I create the file:
FILE* test;
errno_t res = fopen_s(&test, "C:\\test.txt", "a");
if (res != 0) printf("Error opening/creating file\n");
Solution 1:[1]
you need admin privilege on the remote machine. you may need other setting on the remote machine as well. What version of Windows? Just tried on my own boxes. Host win10 admin to self works. Same win 10 host to win 7 root directory no play. This will depend on the exact mechanism of remote access. If you are directly moving the program to another machine- create a desktop icon to invoke it. then right click on the icon: select properties. set permissions. In other words, it is not a programming problem, just a permissions problem.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Sys101 |
