首页 > 其他 > 详细

080.mycat和mycopy

时间:2018-03-28 00:46:50      阅读:245      评论:0      收藏:0      [点我收藏+]

模拟notepad查看txt功能以及模拟复制文件的功能。
Linux。   cat和cp

#include<stdio.h>
#include<stdlib.h>
void main(int l_length, char **l_arr) {
 if (l_length != 3) {
  return;
 }
 FILE * l_fp_read = fopen(l_arr[1], "r");
 FILE * l_fp_write = fopen(l_arr[2], "w");
 if (l_fp_read != NULL) {
  if (l_fp_write != NULL) {
   char l_temp = getc(l_fp_read);
   while (l_temp != EOF) {
    putc(l_temp, l_fp_write);
    l_temp = getc(l_fp_read);
   }
   fclose(l_fp_write);
  }

  fclose(l_fp_read);
 }
}

080.mycat和mycopy

原文:https://www.cnblogs.com/xiaodaxiaonao/p/8661061.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!