获得一个已打开的文本文件(openfile.txt),并把里面的内容输出到新的文本文件中(new.txt)

白羊999 白羊999 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
#include <afx.h>
#include <iostream.h>

void main()
{
// 读文件路径
CString filePathFrom;
filePathFrom.Format("%s", "E:\\openfile.txt");

// 读取文件
CFile filefrom;
char buf[1024];
memset(buf, 0x00, 1024);
filefrom.Open(filePathFrom, CFile::modeRead, NULL);
filefrom.Read(buf, 1024);
filefrom.Close();

// 写文件路径
CString filePathto;
filePathto.Format("%s","E:\\new.txt");

// 定入文件
CFile fileto;
fileto.Open(filePathto, CFile::modeWrite, NULL);
fileto.Write(buf, 1024);
fileto.Close();

// 清理
}

偶不明白这是什么问题?

程序报错是:
--------------------Configuration: 111 - Win32 Debug--------------------
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex
Debug/111.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.

另外,“清理”工作需要做哪些操作?
...全文

相关推荐

评论 6
收藏 已收藏
分享
返回顶部
白羊999
VC/MFC 16,550 成员 421,606 内容