一、通过系统调用(文件)实现cp命令对于普通文件的拷贝
具体实现代码如下:
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<string.h>
#include<fcntl.h>
#include<sys/stat.h>
int CopyFile(char *str,char *des)
{
int num1 = 0;
int num2 = 0;
char buf[11] = {
0};
int fp1 = open(str,O_RDONLY);
int fp2 = open(des,O_RDWR|O_CREAT|O_TRUNC,0664);
if(