/* 标准文档模板 */
#include "Stdio.h"
#include "Conio.h"
#include <sys\stat.h>
#include <time.h>
#include "ctype.h"
#include "stdlib.h"
#include "string.h"
char* NopEnter(char* str) // 此处代码是抄的, 但是比较 好懂.
{
char* p;
if ((p = strchr(str, '\n')) != NULL)
* p = '\0';
return str;
}
int main()
{
FILE* fpSS;
FILE* fpDS;
int err;
char* str;
char* temp;
system("color 17");
str = (char*)malloc(sizeof(char)*101);
temp = (char*)malloc(sizeof(char)*101);
err = fopen_s(&fpSS, "filess.txt", "r");
err = fopen_s(&fpDS, "fileds.txt", "w");
if (fpDS == NULL)
{
puts("-fileds.txt- 文件打开错误!!\n");
exit(-1);
}
if (fpSS == NULL)
{
puts("-filess.Txt- 文件打开错误\n");
fputs("源文件打开错误!", fpDS);
exit(-1);
}
while (fgets(str, 100, fpSS) != NULL)
{
puts(str);
str = NopEnter(str); //去掉回车
fputs(str, fpDS);
}
fclose(fpSS);
fclose(fpDS);
return(0);
}