#include #include using namespace std;

int main() { char ch; ifstream fp1("s2.dat", ios_base::binary); if (!fp1.is_open()) { cout << "can not open s2.dat\n"; return 0; }

ofstream fp2("d2.dat", ios_base::binary);
if (!fp2.is_open())
{
    cout << "can not open d2.dat\n";
    return 0;
}

do { fp1.get(ch); if (ch >= 'A' && ch <= 'Z') { ch += 32; } fp2.put(ch); } while (fp1.good());

fp1.close();
fp2.close();
return 0;

}

C++ 文件读取程序优化:解决无效字符写入问题

原文地址: http://www.cveoy.top/t/topic/oljr 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录