![]() |
#2
zzz32652022-09-11 11:58
|
如果,不理解原因,只是“照猫画虎”修改一下代码。
下次,还会遇到了中文乱码。。。

#include <iostream>
using namespace std;
using namespace System;
using namespace System::IO;
void readfile(String^ filepath)
{
StreamReader^ sr = File::OpenText(filepath);
String^ s = "";
while (s = sr->ReadLine())
Console::WriteLine(s);
}
int main()
{
String^ file1 = "c:\\Users\\Administrator\\Desktop\\A.txt";
String^ file2 = "c:\\Users\\Administrator\\Desktop\\B.txt";
readfile(file1);
Console::WriteLine("\n\n");
readfile(file2);
}
using namespace std;
using namespace System;
using namespace System::IO;
void readfile(String^ filepath)
{
StreamReader^ sr = File::OpenText(filepath);
String^ s = "";
while (s = sr->ReadLine())
Console::WriteLine(s);
}
int main()
{
String^ file1 = "c:\\Users\\Administrator\\Desktop\\A.txt";
String^ file2 = "c:\\Users\\Administrator\\Desktop\\B.txt";
readfile(file1);
Console::WriteLine("\n\n");
readfile(file2);
}
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录
只有本站会员才能查看附件,请 登录