Rewinding std::cout to go back to the beginning of a line

前端 未结 4 1084
迷失自我
迷失自我 2020-11-29 13:05

I\'m writing a command-line tool for Mac OS X that processes a bunch of files. I would like to show the user the current file being processed, but do not want a bazillion fi

4条回答
  •  一生所求
    2020-11-29 13:35

    "\r" should work for both windows and Mac OS X.

    Something like:

    std::cout << "will not see this\rwill see this" << std::flush;
    std::cout << std::endl; // all done
    

提交回复
热议问题