Author Topic: Output console trouble  (Read 13512 times)

Offline tady159

  • Single posting newcomer
  • *
  • Posts: 3
Output console trouble
« on: March 04, 2013, 01:44:21 am »
Hello, this is my first post on this forum.
Today, I was trying to work with language encoding, and after I've compiled the following program, the console output window appeared with a very small font, which makes the output unreadable.
Code
#include <iostream>
#include <windows.h>

using namespace std;

int main()
{

SetConsoleOutputCP(1252);

    cout << "Áá Çç!";
    cin.get();
    return 0;
}

I'm not sure if it directly related to this program or not, but I could not fix it in anyway, I've already tried uninstalling CodeBlocks. My cmd.exe still has a normal font size, and I even tried compiling a code on Dev-C++, and it also gives a normal output. I'm also attaching an image comparing CodeBlock's console output and cmd.exe to show the difference.

[attachment deleted by admin]

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Output console trouble
« Reply #1 on: March 05, 2013, 01:19:23 pm »
The font for the cmd window is user settable.
Click the icon at the top left of the window.
Chose properties, then the font tab. Change the font.
If prompted, save the layout as "for this program only", or "for all command windows".

Offline tady159

  • Single posting newcomer
  • *
  • Posts: 3
Re: Output console trouble
« Reply #2 on: March 06, 2013, 01:05:20 am »
I've tried to change the font size, and I've somehow managed to make it readable again, but now, I've noticed two problems:
First, my computer is set to Japanese locale for non-unicode programs, which makes the console able to show Japanese characters, even programs compiled that use them are showed correctly, but this is not the case with the console output from CodeBlocks, it shows them wrongly. Executing the .exe created on the source's folder shows the characters correctly, since it is executed on cmd instead.
Second, I noticed that it doesn't have the same fonts available as cmd does, which may relate to the first problem.

I tried to make some research, with no good results, out of finding out that the name of the program responsible for CodeBlock's output console is cb_console_runner.exe.

Attached to this post is a comparison of cb_console_runner and cmd's fonts available. As well the result of a short code that should print the character "あ", but is showing "éá" instead.

[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Output console trouble
« Reply #3 on: March 06, 2013, 07:19:56 am »
cb_console_runner is juat a wrapper, that calls cmd.exe on windows, but it might use a different user-context.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Output console trouble
« Reply #4 on: March 06, 2013, 07:24:42 am »
If you run your exe through the debugger it does not use cb_console_runner as far as I know, so you can try this also.

You might need to add a breakpoint before the return statement of the program, because the terminal is normally closed immediately after the program has been run (that's one cause to call it through cb_console_runner by the way).

Offline tady159

  • Single posting newcomer
  • *
  • Posts: 3
Re: Output console trouble
« Reply #5 on: March 06, 2013, 11:27:46 am »
I'm not sure why, but the start debug option is grayed out, which means I can't run it.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Output console trouble
« Reply #6 on: March 06, 2013, 11:55:29 am »
I'm not sure why, but the start debug option is grayed out, which means I can't run it.
Do you have just a file (in this case debugging does not work) or a project ?

cb_console_runner is juat a wrapper, that calls cmd.exe on windows, but it might use a different user-context.
What I wrote is not absolutely correct, cb_console_runner calls CreateProcess, which runs the command processor (as far as I know) but using the Autorun-key in regedit for the command processor to change the default codepage is ignored when called via cb_console_runner, but used for direct invoking of cmd.exe. Nevertheless additional fonts set via regedit are visible (at least in the default settings of the cb_console_runner window).