Entries from 2016-09-04 to 1 day

Problem set 5 - Makefile

Problem Set 5: Mispellings Pset5, Makefile がいかにしてmakeにhow to compile (speller)を教えているかの詳細な解説があり..."Know that you’re welcome to modify this Makefile as you see fit. In fact, you should if you create any .c or .h files …

無限ループはwhile(1)で

recoverで参照したサイトまとめ。①無限ループ ループの常套手段②jpegのsignatureを判断するのに使った関数たち memcmp memchr③printfさながらにarrayに値を格納したいなら、sprintfを使うほか無い。 (C言語、不便すぎる) sprintf④###.jpgをどうやって表示す…

GDBとValgrindを使ってみた

意外に簡単だった、記念のスクショ。①GDB 基本的には、gdb ファイル名→run→より細かいbugの場所を調べるため、bt(backtrace)のコンボ。②Valgrind(memory leakがないか調べる) resize recover 基本は、コンパイル→valgrind 実行 でよろし。 All heap blocks w…

Problem set 4 - fread/fwrite

fread(&bf, size, number, inptr): 1つ目の引数は、読み込んだデータを格納する場所(readで読んだものを一時的に格納するポインタ)。 readを行うと、&bfの中にデータが格納される 格納されたあとは、.なんとかでデータのさらに細かい部分にアクセスできる re…

Problem set 4 - resize

biSize total size of image (in bytes) includes pixels and padding BITMAPINFOHEADER 構造体のサイズが格納されており、Windows ビットマップの場合は 0x28 である。 (注意!! resizeしてもbiSizeを変えてはならず、biSizeImageをupdateさせること。これ、…

Problem set 4 - stdint.hつづき

whodunitのquestionsで幾つか気になったものをpickup.①What’s the point of using uint8_t, uint32_t, int32_t, and uint16_t in a program? 整数型に対応するビット数は、マシン&コンパイラ毎に異なる。よって、全ての人(マシン&コンパイラの組み合わせ)が…

Problem set 4 whodunit - stdint.hとintN_t

stdint.hとintN_tに関するメモ、箇条書き stdint.hについて intN_t: stdint.hにおいてtypedef 〇〇 intN_tで定義される。〇〇はint, long等既存の型(と言うより、正確には基本的な型としてコンパイラの中に存在する型)のこと。 intの表す数字の範囲はパソコ…