2

I have a completely working version of fifteen and want to try to alter the ascetics using the ANSI ESC functions that are hinted at.

I have looked at their implementation of the clear function as instructed, but where the web page linked in the pset description says to use ESC[#;, the clear functions uses printf("\033[2J").

I was hoping that someone that knew how to use the ANSI techniques could advise me on how and where to implement them.

1

I guess it is best practice, I wrote this little program as an example, I hope it serves to understand how the escape sequences work.

#include <stdio.h>

int main (void)
{
    printf("\033[31m");
    printf("This is a red text\n");
    printf("\033[0m");

    printf("\033[1;32m");
    printf("This is a green bold text\n");
    printf("\033[0m");

    printf("\033[44;1;35m");
    printf("This is a magenta bold text on a blue background");
    printf("\033[0m\n");      
}
1

per the Wikipedia article:

Escape sequences start with the character ESC (ASCII decimal 27/hex 0x1B/octal 033).

However, most of the sequences are more than two characters, and start with the characters ESC and [ (left bracket). This sequence is called CSI for Control Sequence Introducer (or Control Sequence Initiator).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .