C言語:printfデバッグチートシート
printf では見えないケースが多いのでファイルに残す
code:print_to_file.c
FILE *pFile = NULL;
pFile = fopen("/tmp/mytest.log", "at");
fprintf(pFile, "%s\n", "Hello, world!");
fprintf(pFile, "%02hhx\n", char_value);
fprintf(pFile, "%hd\n", short_value);
fprintf(pFile, "%d\n", int_value);
fprintf(pFile, "%ld\n", long_value);
fprintf(pFile, "%lld\n", longlong_value);
fprintf(pFile, "%hf\n", float_value);
fprintf(pFile, "%f\n", double_value);
fprintf(pFile, "%lf\n", long_double_value);
fprintf(pFile, "%p\n", pointer);
fprintf(pFile, "%zu\n", size_t_value);
fprintf(pFile, "%zu\n", size_t_value);
fprintf(pFile, "%" PRIdMAX "\n", (intmax_t)value);
fclose(pFile);