cout location
When drawing to the console screen, how would I set cout to start at a specific location, without using a bunch of newlines and spaces? I want to draw at a single spot without overwriting anything else on the screen.
i think the funtion you want is SetCursorPosition(),
google it, and ask more if you have any trouble
google it, and ask more if you have any trouble
std::cout is a stream. A file-like channel. C and C++ only know how to manipulate files. They do not know the file really is a console. In fact, it might not, if you have redirected it when starting the program by writing myprogram > outputfile. If you do that, all the std::cout writes wil end up in the "outputfile" file.
If you want to manipulate a console, you need to rely on whatever platform-specific API you are using like SetCursorPosition, as micro_mus suggested, not on C++ library functions.
If you want to manipulate a console, you need to rely on whatever platform-specific API you are using like SetCursorPosition, as micro_mus suggested, not on C++ library functions.
Thanks, that's what I needed. Well, I saw some characters in basic that lined up and didn't have gaps, (double lines) how would I display those in C++?
Quote:Original post by ukdeveloper
What about <iomanip>? Or am I misunderstanding his question?
<iomanip> contains components that let you control formatting, like how many decimal places do you want to display when printing a floating point number or whether you want your integers printed in decimal or hexadecimal format. That kind of things. While it can let you pad printed fields to a given width, it still doesn't know - or care - about the nature of the device it is writing to.
Quote:Original post by Scavenger23
Thanks, that's what I needed. Well, I saw some characters in basic that lined up and didn't have gaps, (double lines) how would I display those in C++?
what do you mean by that? if you mean move the characters according to pixels, thats not possible through the console. The console screen will be split into character spaces not pixels. i think the default size for a dos(ugh) window is 80x25.
This is what I mean. How can I use that character set? I want to use the double line symbols near the bottom of the set.
Ascii Table
Look at the bottom, say you want character 186, using char test = static_cast(186); std::cout <
Look at the bottom, say you want character 186, using char test = static_cast(186); std::cout <
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement