Change file access Chmod

From , 5 Years ago, written in C, viewed 235 times.
URL https://pastebin.vip/view/1c6a0198
  1. #include <sys\stat.h>
  2. #include <stdio.h>
  3. #include <io.h>
  4.  
  5. void make_read_only ( char *filename );
  6.  
  7. int main ( void )
  8. {
  9.         make_read_only ( "NOTEXIST.FIL" );
  10.         make_read_only ( "MYFILE.FIL" );
  11.         return 0;
  12. }
  13.  
  14. void make_read_only ( char *filename )
  15. {
  16.         int stat;
  17.  
  18.         stat = chmod ( filename, S_IREAD );
  19.         if ( stat )
  20.                 printf ( "Couldn't make %s read-only\n", filename );
  21.         else
  22.                 printf ( "Made %s read-only\n", filename );
  23. }

Reply to "Change file access Chmod"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website