1

I generated a table into console and it went great but when i add "uses crt;", the labels, lines etc. which I made using chr(ord.value); , and also language special characters go wild, so I guess it somehow changes encoding.

I work in Win7,FPC IDE v.2.6.4

Another wierd thing is that when I run the program, it starts in cmd.exe classical Windows console but after like 10 seconds it closes itself and a new run is started in another console located in FPC window(where it doesn't close itself).

The wierdest thing is that the adding of "uses crt;" doesn't do anything with the table written into cmd.exe classic Windows console...

So my solution whould be either to work out how to change the encoding in the console located in FPC window or how to prevent cmd.exe from closing itself.

Hope Someone can help me, I'll really appreciate it.

Rohit Gupta
  • 4,022
  • 20
  • 31
  • 41
Marek Židek
  • 809
  • 1
  • 15
  • 31
  • https://en.wikipedia.org/wiki/Code_page_437 – Hans Passant Dec 30 '14 at 15:59
  • @HansPassant thanks for replying, but there's nothing written about the Crt library changing the encoding. – Marek Židek Dec 30 '14 at 16:19
  • 3
    Your assumption that it changes the encoding is just wrong. The default codepage for console apps is 437. Not the same codepage your editor is likely to use. Crt is too primitive to give you an option to change it, you'd have to call SetConsoleCP() somehow. Or use the CHCP command before running your app. And change the font. – Hans Passant Dec 30 '14 at 16:42
  • Importing crt and writing the output of getconsolecp outputs "850" here. Characters with "accents" is ill defined. The same character can have different values in different encodings. So you have a bunch of characters in _what_ codepage exactly ? – Marco van de Voort Dec 31 '14 at 19:38

1 Answers1

0

If youd don't use Crt, then output is using standard DOS routines. Crt unit redirects the Input and Output standard text files to CRT instead to DOS's standard input and output files. But you can explicitly assign it back by executing:

Assign(Input, ''); Reset(Input);
Assign(Output, ''); Reset(Output);
swisst
  • 92
  • 8