↧
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 ArticleAnswer 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 ArticleAnswer 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 ArticleCreate 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