Fix for extra characters in progress text in Website::getGames

If we print shorter progress text than we printed earlier then characters from the earlier string would remain on the terminal because the line was not cleared.
Clear the line before printing to avoid the extra characters.
This commit is contained in:
Sude 2016-11-15 19:50:00 +02:00
parent 9842c070e4
commit c635cdabe8

View File

@ -157,7 +157,7 @@ std::vector<gameItem> Website::getGames()
{
for (unsigned int i = 0; i < root["products"].size(); ++i)
{
std::cerr << "Getting game names " << "(" << root["page"].asInt() << "/" << root["totalPages"].asInt() << ") " << i+1 << " / " << root["products"].size() << "\r" << std::flush;
std::cerr << "\033[KGetting game names " << "(" << root["page"].asInt() << "/" << root["totalPages"].asInt() << ") " << i+1 << " / " << root["products"].size() << "\r" << std::flush;
Json::Value product = root["products"][i];
gameItem game;
game.name = product["slug"].asString();