How to set color when calling printf in assembly

Viewed 477

I want to set the color when I call printf from assembly.

This is my code:

Out:    
    mov     rdi, answer
    mov     rsi, r10
    mov     rax,0
    call    printf
section .data
    answer:     db       "\033[0;31m%d\033[0m",10,0

I use NASM to compile and gcc to link:

nasm -f elf64 "%f"
gcc -o %e %e.o

However, the output is:

\033[0;31m(my r10)\033[0m
1 Answers
Related