2
我正在寫一個多行系統,就像這樣:C++回去線
string readLines(string x)
{
string temp = "a";
vector<string> lines(0);
string result;
while (1)
{
cout << x;
getline(cin, temp)
if(temp != "")
{
result = result + "\n" + temp;
lines.push_back(temp);
}
else
break;
}
return result;
}
工作正常,但我希望能夠編輯前行,例如,我打字的東西像這樣:
Helo,
World
我想回到helo
並修復我的錯字。我怎樣才能做到這一點?
您希望與終端進行特定於平臺的交互。 (AKA,Windows不同於Linux不同於.....)。 'ncurses'是一個流行的庫,它將平臺特定的位抽象出來。 – druckermanly
這不是輸入流功能的性質。 –
@druckermanly,我在Windows上工作 –