zoukankan      html  css  js  c++  java
  • 数据文件——之重命名或删除文件

    代码:

     1 //This is c program code!
     2 /* *=+=+=+=+* *** *=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
     3   * 文档信息: *** :~/WORKM/stutyCode/cCode/recipesProblemSolution/chapter06/test6_15.c
     4   * 版权声明: *** :(魎魍魅魑)MIT
     5   * 联络信箱: *** :guochaoxxl@163.com
     6   * 创建时间: *** :2020年11月21日的下午07:31
     7   * 文档用途: *** :数据结构与算法分析-c语言描述
     8   * 作者信息: *** :guochaoxxl(http://cnblogs.com/guochaoxxl)
     9   * 修订时间: *** :2020年第46周 11月21日 星期六 下午07:31 (第326天)
    10   * 文件描述: *** :自行添加
    11  * *+=+=+=+=* *** *+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+*/
    12 #include <stdio.h>
    13 
    14 int main(int argc, char **argv)
    15 {
    16     char ch;
    17     printf("please select operation: r or d: ");
    18     scanf("%c", &ch);
    19     int tmp = getchar();                                                                
    20     if(ch == 'r'){
    21         int ren = rename("kolkata.txt", "city.dat");
    22         if(0 == ren){
    23             puts("Operation of renaming a file is successful.");
    24         }else{
    25             puts("Operation of renaming a file is failed!");
    26         }
    27     }   
    28         
    29     if(ch == 'd'){
    30         int rem = remove("city.dat");
    31         if(0 == rem){
    32             puts("Operation of deletion a file is successful.");
    33         }else{
    34             puts("Operation of deletion a file is failed!");
    35         }
    36     } 
    37 
    38     return 0;
    39 }
  • 相关阅读:
    python核心编程2 第八章 练习
    python核心编程2 第六章 练习
    python核心编程2 第五章 练习
    Redis
    CENTOS7错误:Cannot find a valid baseurl for repo: base/7/x86_6
    HTTP协议
    计算机网络知识点
    好记性不如烂笔头~
    一些算法题
    解决mysql插入数据时出现Incorrect string value: 'xF0x9F...' 的异常
  • 原文地址:https://www.cnblogs.com/guochaoxxl/p/14054210.html
Copyright © 2011-2022 走看看