Quantcast
Channel: Create a read-only file in C++ - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Michael Haephrati for Create a read-only file in C++

I would use the following code:HANDLE hFile = CreateFile(L"read_only_file.txt", GENERIC_ALL, 0, NULL, FILE_SHARE_WRITE, FILE_ATTRIBUTE_READONLY, NULL);

View Article



Answer by JFed-9 for Create a read-only file in C++

You could also just do this:ofstream out;out.open("test.txt");out.close();//attrib [parameters] [file]//+R -> readonly//+H -> hidden//+S -> system file (ultra hidden)//There are more, type...

View Article

Answer by AndyG for Create a read-only file in C++

You can use boost::filesystem to accomplish this with the following function:void permissions(const path& p, perms prms);a path can be constructed from a string, so no problem there. The hard part...

View Article

Create a read-only file in C++

I need save textual information using my VC++ MFC application in a file such that it will be read-only. So far, I have considered two alternatives, but I am not happy with either 1) I could save the...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images