Semi-Graphical Program

How do I get input that is surrounded by output
Also how can I color parts of the screen
How do I get input from arrow keys
If anyone knows any of these (Windows/Linux) it'd be very helpful
Here's an example...
1
2
3
4
5
6
7
|My green text on red background. |
|     +---------------------+   |
|     |My red text on green.  |   |
|     |Please write something |   |
|     |>MyName                 |   |
|     +---------------------+   |
+------------------------------|
Last edited on
This is EXACTLY what wanted to and did in the console.

However, before you ask questions, such as color output(It has been answered many times) please search these forums.

How do I get input that is surrounded by output


What you really mean is:

How can I output, then bring the cursor back before the output?

Use this:

1
2
3
COORD temp  = {1, //X value
1}; // Y value
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), temp);


This sets the cursor position to 1,1. The console output input will now proceed from that point, even to overwrite output.

You should use Duoas's PressAnyKey function (without print message) or getch(sorry to say). And compare the char with Windows.h's VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT
Ok I. Need one for linux preferably but doing a simple search reveals only Win32...
I am using a linux but I am giving the program to a windows user...
I would also prefer it not to have any libraries that aren't standard...
Last edited on
That is hard. I don't know how. I think that you should just either move on to windowed programming, or just not use advanced console things like that. I actually did a very advanced console app. It was so cool. If you want, I can tell you how to do it.
Last edited on
Send me a private message with it source code and/or explanation... I learn a lot by reading code...
Also I'm not really on a linux I'm on an android but idk is an android technically a linux?
I don't know. PM coming.
Topic archived. No new replies allowed.