ソースを参照

Example ANSI color file from

https://en.wikipedia.org/wiki/ANSI_escape_code#Example_of_use_in_C
bugz 4 年 前
コミット
391202b7c6
2 ファイル変更31 行追加0 行削除
  1. 1 0
      CMakeLists.txt
  2. 30 0
      ansi-color.c

+ 1 - 0
CMakeLists.txt

@@ -51,4 +51,5 @@ target_link_libraries(mystic zf_log)
 
 add_executable(try-re try-re.c)
 
+add_executable(ansi-color ansi-color.c)
 

+ 30 - 0
ansi-color.c

@@ -0,0 +1,30 @@
+#include <stdio.h>
+
+
+int main(void)
+
+{
+
+  int i, j, n;
+
+  
+
+  for (i = 0; i < 11; i++) {
+
+    for (j = 0; j < 10; j++) {
+
+      n = 10*i + j;
+
+      if (n > 108) break;
+
+      printf("\033[%dm %3d\033[m", n, n);
+
+    }
+
+    printf("\n");
+
+  }
+
+  return (0);
+
+}