switchbrew / libnx

Library for Switch Homebrew

Home Page:https://switchbrew.github.io/libnx/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ASCII Usage of "\"

Cid2mizard opened this issue · comments

By performing tests with ASCII, I realized to de-sing a simple character this is a problem. Indeed, the character "" is unusable while it is widely used.

printf("\x1b[10;10H   O ");
printf("\x1b[10;11H  /|\ ");
printf("\x1b[10;12H  / \ ");

Have an error warning: unknown escape sequence: '\040'

First of all this is not libnx related, but GCC related.
Compiler is responsible for escape sequences

And it seems you don't know about escape sequences.

your code should look like this to properly render stickman

printf("\x1b[10;10H   O \n");
printf("\x1b[10;11H  /|\\ \n");
printf("\x1b[10;12H  / \\ \n");

It's not just gcc, the \ character is used to start an escape sequence in most languages I know. You can also see github's markdown ignoring the single slash in the OP where it displays as "" instead of the intended "\"

Wikipedia has a brief explanation at https://en.wikipedia.org/wiki/Escape_sequences_in_C