[C] 删除DOS文件目录 →→→→→进入此内容的聊天室

来自 , 2019-10-29, 写在 C, 查看 107 次.
URL http://www.code666.cn/view/074177d3
  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include <process.h>
  4. #include <dir.h>
  5.  
  6. #define DIRNAME "testdir.$$$"
  7.  
  8. int main(void)
  9. {
  10.    int stat;
  11.  
  12.    stat = mkdir(DIRNAME);
  13.    if (!stat)
  14.           printf("Directory created\n");
  15.    else
  16.    {
  17.       printf("Unable to create directory\n");
  18.       exit(1);
  19.    }
  20.  
  21.    getch();
  22.    system("dir/p");
  23.    getch();
  24.  
  25.    stat = rmdir(DIRNAME);
  26.    if (!stat)
  27.           printf("\nDirectory deleted\n");
  28.    else
  29.    {
  30.    perror("\nUnable to delete directory\n");
  31.       exit(1);
  32.    }
  33.  
  34.    return 0;
  35. }
  36.  

回复 " 删除DOS文件目录"

这儿你可以回复上面这条便签

captcha