C console window title

How to set console window title in C?

printf("%c]0;%s%c", '\033', "My Console Title", '\007'); 

This only works on Linux, not windows. Does anyone know a cross-platform solution? (of course, not "system (title = blah)")

+6
c console title
source share
4 answers

windows.h defines SetConsoleTitle() .

You can use this everywhere and declare your own function for Linux platforms that do the same.

+6
source share

It sounds like this post: (which is for Java, but the accepted answer uses JNI [ie C Native call].

How to change the name of the command prompt window (console) from the command line of a Java application?

0
source share

You can do this by calling SetConsoleTitle .

0
source share

Perhaps you need to implement the cross-playform solution yourself.

For Windows 2000+, you can use SetConsoleTitle (), more information can be found on MSDN .

0
source share

All Articles