I want to create a menu where the user can just press a button and choose from the options on the screen.
I've tried using getchar(), fgets(stdin), gets(), and even getch().
I've turned to using some inline assembly to get ONE character from stdin. The code i've used is as follows :
char io::u_i() {
    char a;
    __asm__("INT 0x21;"     // Interruption vector for input
            "MOV %1, %0;"   // Move from stdin to a
            : "=r" (a)      // Output variable
            : "r" (stdin)   // Input variable
            : "%1"          // Obfuscated registers
            );
    return a;
}
If I've understood well enough how G++ compiles assembly, it should send an interrupt vector (0x21 being the one I found online to ask a key press), then move what is in the register where G++ will take the input (so stdin in this case) to the register where G++ will take the output.
I've done a bit of regular assembly before (AT&T syntax), without asking for user input. So this is a bit of a new territory for me. G++ tells me there is an error at this point in the code :
sources/io.cpp:7:11: error: invalid operand for instruction
                __asm__("INT 0x21;"     // Interruption vector for input
                        ^
<inline asm>:1:6: note: instantiated into assembly here
        INT 0x21;MOV %rcx, %r8b;
            ^~~~~
sources/io.cpp:7:11: error: unknown use of instruction mnemonic without a size suffix
                __asm__("INT 0x21;"     // Interruption vector for input
                        ^
<inline asm>:1:11: note: instantiated into assembly here
        INT 0x21;MOV %rcx, %r8b;
                 ^
But in my introduction to assembly, there was no need for anything else than INT 0x21;, so I don't see what G++ expects from me here. Is there a specific compiler option for inline ASM with AT&T syntax ?
Is my piece of code even going to do what I expect from it ?
P.S. : If it can help you in any way, I am compiling this on macOS Sierra, and here is the output of g++ --version :
Configured with: --prefix=/Library/Developer/CommandLineTools/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 8.1.0 (clang-802.0.38)
Target: x86_64-apple-darwin16.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin