Recent

Author Topic: Characters, uses crt  (Read 1926 times)

copY

  • New member
  • *
  • Posts: 8
Characters, uses crt
« on: April 25, 2017, 02:51:08 pm »
Hi! I ama newbie, not in coding but using Lazarus. I downloaded this yesterday, because i wanted something better than the basic freepascal.
The probelm is that im writing an XO game, and i have to draw a table to the console, where the players gonna play.
When i use write(chr(196)); this works, without any problem,but i have to use "uses crt" too to clear screen and gotoxy. When im writing uses crt, the write(chr(196)) doenst work anymore, write another character, which i dont want to use.
I saw a question like mine, but i didnt undersant the solution method. Can someone help me out? Thank you.
~copY

Bart

  • Hero Member
  • *****
  • Posts: 5288
    • Bart en Mariska's Webstek
Re: Characters, uses crt
« Reply #1 on: April 25, 2017, 06:52:07 pm »
Crt does this when writing to the console:
  SetConsoleOutputCP(GetACP);
So when you write UTF8 (default encoding of source editor of Lazarus) to the console you are screwed.

Even if you save the sourcecode as cp1252 (default Western European codepage on Windows) yo have a problem.
The characters you want to write ('╔═╗' etc) are not available in cp1252 , so you cannot write them to screen using crt unit.

Bart

 

TinyPortal © 2005-2018