Advertisement
image28

Linux File Holder

Jun 25th, 2016
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. // Image28:
  2. // While this program is attached to a file, the file can be moved/deleted/renamed and still remain accessible through
  3. // the proc filesystem
  4.  
  5. #include <stdio.h>   /* Standard input/output voidinitions */
  6. #include <string.h>  /* String function voidinitions */
  7. #include <unistd.h>  /* UNIX standard function voidinitions */
  8.  
  9. int main(int argc, char *argv[])
  10. {
  11.     FILE *input;
  12.     char wait[1024];
  13.     int done=0;
  14.  
  15.     if ( (input=fopen(argv[1],"rb")) != NULL )
  16.     {
  17.         while(!done)
  18.         {
  19.             scanf("%s",wait);
  20.             if ( strncmp(wait,"exit",4) == 0 )
  21.             {
  22.                 done=1;
  23.             }
  24.         }
  25.     }
  26.  
  27.     printf("File hold released");
  28.     return(0);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement