Carriage return inconsistency with XCode
I have a problem using a carriage return to rewind to the beginning of a line within XCode.
This small开发者_如何学编程 example:
std::cout << "will not see this\rwill see this" << std::flush;
std::cout << std::endl; // all done
compiled in XCode results in:
will not see this
will see this
whereas, when I compile it in the terminal using G++ I get:
will see thisthis
How can I make XCode show the latter (and expected) behavior ?
cheers Daniel
Are you running the Xcode-compiled application in the Terminal or are you reading the output from the debug Console? They are two different outputs and may have different formatting. Xcode uses gcc under the hood so I am surprised at the results you are seeing here. In addition this question (Which you seem to have found) gave me the results I wanted by using \r
to return to the beginning of a line.
精彩评论