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

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

$
0
0

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 'attrib /?' in cmd to find all of the optionssystem("attrib +R test.txt");

And that's it! Let me know if you have any questions.

EDIT

This only works on Windows, as it uses a direct console command.


Viewing all articles
Browse latest Browse all 4

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>