I've been looking but not finding, how would I go about outputting special characters (Extended ASCII) in console?
And on the same token, is there a way to place the cursor at a specific location using coordinates?
Does constructing a string literal that contains those characters and then passing it to echo not display the same string in the terminal? It should.
For terminal manipulation, see this: http://nim-lang.org/terminal.html
There's also this: https://github.com/fowlmouth/nim-termbox.git, but I don't know if it works on windows.
"Extended ASCII" hasn't meant anything for like 20 years.
To use non-ASCII characters, the best thing to do is encode your string in UTF-8 (if it looks right in a text editor, it's probably UTF-8), and echo them to a terminal that understands UTF-8 (anything but Windows' cmd.exe).
If you're asking about "extended ASCII" because you're on cmd.exe and you're using one of its two dodgy old sets of 256 characters -- try putting the bytes for those characters in your string, and see what happens, but keep in mind that the result is going to be extremely non-portable.
Yes, the target is windows console window.
The use of extended ascii, example here http://www.asciitable.com/ to build a simple GUI in a console window.
For what it's worth, this particular extension of ASCII is called "codepage 437", and cmd.exe is one of the last vestiges of its existence. Windows doesn't even use it anywhere else. cmd.exe just uses it because it's pretending to be MS-DOS.
But anyway, if you put the byte 0xc0 (decimal 192) in a string, and you echo it to the Windows console, you should get the └ character.
It's unlikely that you have a text editor that will show you your string literals in codepage 437 -- unless it's an old DOS text editor running inside cmd.exe -- so you won't be able to get that 0xc0 to look like └ in your source code. You're going to have to use escape sequences, such as "\xc0", to put these bytes in string literals.
Do keep in mind how non-portable this is. If you were to run the same program in Windows PowerShell, you'd get different characters, and if you ever ran it on a non-Windows system, you'd get completely unreadable output.
Thanks, rspeer.
Yes I'm quite aware of how unportable and archaic it is.
It seems to work exactly like I wanted, thank you