標準出力

新しいもの、変わらないこと 自分の頭を通して考えてみました (stdout)

c

(広義の)コンパイルの工程

c

分かっていなかった事が分かったのでコンパイルの工程を復習するために hello.cに依存しているtest.cのコンパイル過程をFreeBSD 9.1 RELEASE で出力してみた。-hello.h-#ifndef HELLO_H#define HELLO_Hint sayHello(void);#endif-hello.c-#include "stdio.h"…

イベントハンドラのサンプル

C

#include typedef int (*EVHND)(int, int);int proc(EVHND evhnd){ printf("Error occured !!\n"); if(evhnd != NULL) evhnd(4,2); return -1;}int evha(int a, int b){ printf("event hundler A %d\n", a-b); return 0;}int evhb(int a,int b){ printf("eve…

ファイル名等組み込みマクロ

c

恥ずかしながらどうやってるのだろうと気になっていたけどやっと知る事ができたのでメモ 1 #include 2 3 int main(void){ 4 5 printf("error message in %s line: %d\n",__FILE__,__LINE__); 6 7 return 0; 8 }標準出力error message in test.c line: 5

共有ライブラリの作成とライブラリ検索PATHについて

c

Ubuntu特有の作法でハマったのでメモ まずは、ライブラリの作成hello.h #ifndef HELLO_H#define HELLO_Hvoid sayHello();#endifhello.c #include#include"hello.h"void sayHello(){ printf("Hello!!\n");}そして、共有ライブラリ作成。ここでは、ヘッダーフ…

型の値範囲

c

バイナリデータを扱うようになって意識するようになったのでメモ#include#includeint main(int argc,char **argv){ printf("size of char: %d bit\n",CHAR_BIT); printf(" char range is %d -> %d\n",CHAR_MIN,CHAR_MAX); printf(" signed char range is %d …