不知道爲什麼會發生這種情況,似乎所有東西都應該排列起來,除非有什麼東西丟失。我無法傳遞這些變量,無論我試圖在編譯器中拋出什麼,它只是給了我另一個錯誤。無法將參數2從'std :: string *'轉換爲'std :: string'
這是我的代碼到目前爲止。
void parse(string name, string storage_1, string storage_2, string storage_3)
{//some code
}
//some more code
int start = 0;
int length = 0;
string param_1, param_2, param_3;
while (!infile.eof())
{
if (!infile)
{
cout << "ERROR: File " << file << " could not be located!" << endl << endl;
break;
}
param_1.clear();
param_2.clear();
param_3.clear();
line_input.clear();
getline(infile, line_input);
parse(line_input, ¶m_1, ¶m_2, ¶m_3);
cout << param_1 << endl << param_2 << endl << param_3 << endl << endl;
}
任何特別的原因,你正在做'的&param_x'而不是簡單地'param_x'? – 0x499602D2 2014-10-17 01:53:01
編譯器錯誤表示它:您正在將指針傳遞給您的解析函數,但它期望字符串。 – Oguk 2014-10-17 01:53:27
我想自己修改param_x變量 – 2014-10-17 01:55:26