2011-06-02から1日間の記事一覧
$ cc -o hello hello.c -DHELLO="\"hello, world!\"" $ ./hello hello, world!などと、コンパイルオプションで渡した文字列をソースコードで使うにはどうしたらいいか?解答編: #define quote(x) q(x) #define q(x) #x #include <stdio.h> int main() { puts(quote(H</stdio.h>…
$ cc -o hello hello.c -DHELLO="\"hello, world!\"" $ ./hello hello, world!などと、コンパイルオプションで渡した文字列をソースコードで使うにはどうしたらいいか?解答編: #define quote(x) q(x) #define q(x) #x #include <stdio.h> int main() { puts(quote(H</stdio.h>…