Linux remove and rename function use

#include <stdio.h> 
#include <stdlib.h> int main () 
{ int ret = rename ( " ./file_mmap " , " / root / file_mmap " );  
    if (ret < 0 ) 
   { 
     perror ( " rename error \ n " ); 
   } / * ** 
   (1) Rename this path 
   (2) Move the file. Note that you must use an absolute path instead of a relative path 
   * * / 
   remove ( " aabc.c " );   // Delete files are c Library 
   printf ( " ret is% d \ n "


   
   ,ret);
   while(1);

 return 0;
}

 

Guess you like

Origin www.cnblogs.com/nowroot/p/12749279.html