这是我现在的代码
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char* argv[])
{
// set up input file
ifstream lInput; // declare an input file variable (object)
ofstream lOutput;
lInput.open(argv[1], ifstream::binary); // open an input file (binary)
lOutput.open(argv[2], ofstream::binary);
if (!lInput.good())
{
// operation failed
cerr << "Cannot open input file " << argv[1] << endl;
return 2; // program failed (input)
}
lOutput << "test" << endl;
lOutput << "test2" << endl;
我目前的输出是
测试测试2
我怎样才能做到
测试
测试2
谢谢您的帮助
编辑:测试到“测试”和测试2到“测试2”编辑2:lOutpt到lOutput