0
我有一個代碼,我希望它從命令行獲得輸入文件,並在最後創建輸出文件與XXX - 意思是如果intput =「blabla.txt」或「/ johny/first/blabla.txt「我直到得到」blablaXXX.txt「或」/johny/first/blablaXXX.txt「複製字符串直到'。'以及如何只複製當我知道結構
第二個問題是,當我找到一條線我正在尋找我想只複製數字(保持時間模式)和len個
線將「在此時間12:04:56.186,LEN 000120」
,我想在新文件一線得到:12:04 :56.186 120
#include <iostream>
#include <fstream>
using namespace std;
int main(int argc, char* args[])
{
string inputName=args[1];
ifstream inputName(inputFileName);
////// here i will need to get the output string name some thing like
// string outputFileName=EDITED_INPUT_NAME+"XXX"+".txt";
ofstream outpuName(outputFileName);
while(std::getline(inputName, line))
{
if(line.find("IT IS HERE") != string::npos)
// how to make it take only the parts i need??????
outpuName << line << endl;
cout << line << endl;
}
inputName.close();
outpuName.close();
return 0;
}