tags:

views:

77

answers:

5

How would you set the initial position of a Console App on your Screen?

+6  A: 

It's a console app, so it has no concept of where its window is, as it doesn't know what a window is.

Rowland Shaw
Come on, there's no need to be pedantic. The console app can find which window it is in (Assuming you know what windowing system you're running under).
Andrew Bainbridge
A: 

If you're in windows, then you have to set the position of the final executable. If you click the application icon and then click "Defaults" on the resulting menu, one of the options is for position.

Unfortunately, no idea how to do that on other platforms.

Bryan Ross
+1  A: 

I think that you're going to be more specific. With a console app, the output goes to stdout without any real control over how the console deals with it. The console deals with displaying it and normally just prints it out.

If you want more control over the console like being able to reposition the cursor or being able to erase or redraw portions of the console, then you'll likely need to look into a library like ncurses.

Jonathan M Davis
+1  A: 

You can't. Put simply. If you use non-standard extensions, for example, if you made your own console via WinAPI, you might be able to make such an effect. However, within terms of just cin/cout, then you can't.

DeadMG
+4  A: 

For Windows, you could use the GetConsoleWindow function followed by SetWindowPos with the SWP_NOSIZE and SWP_NOZORDER flags set.

Mark Ransom