#include <sys\stat.h> #include <stdio.h> #include <io.h> void make_read_only ( char *filename ); int main ( void ) { make_read_only ( "NOTEXIST.FIL" ); make_read_only ( "MYFILE.FIL" ); return 0; } void make_read_only ( char *filename ) { int stat; stat = chmod ( filename, S_IREAD ); if ( stat ) printf ( "Couldn't make %s read-only\n", filename ); else printf ( "Made %s read-only\n", filename ); }