(clang) macro shenanigans with strings
This commit is contained in:
1 parent
7e5eb2107c
commit
4f08a40e2f
1 file changed
+7
-4
+7
-4
@@ -3,12 +3,15 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#define ESCAPE "\x1b"
|
||||
#define SEQUENCE_PREFIX ESCAPE"["
|
||||
#define SEQUENCE_SUFFIX "m"
|
||||
#define SEQUENCE_RED SEQUENCE_PREFIX"31"SEQUENCE_SUFFIX
|
||||
#define SEQUENCE_RESET SEQUENCE_PREFIX"0"SEQUENCE_SUFFIX
|
||||
|
||||
int main(void)
|
||||
{
|
||||
char* sequence_red = "\x1b[31m";
|
||||
char* sequence_reset = "\x1b[0m";
|
||||
|
||||
(void)printf( "%salarm!%s", sequence_red, sequence_reset );
|
||||
(void)printf( "%salarm!%s", SEQUENCE_RED, SEQUENCE_RESET );
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user