developer's diary

最近はc#のエントリが多いです

C

Cの基本データ型

C

データ型 扱える値 解説 char -128〜127 'a'や'0'の1文字を扱う型 int -32768〜32767 整数を扱う型 long -2147483648〜2147483647 intより大きい整数型 float 符号付き単精度浮動小数点型(4バイト分) 小数を扱う型 double 符号付き倍精度浮動小数点型(8バ…

ANSIライブラリ

C

abort abs acos asctime asin assert atan atan2 atexit atof atoi atol bserch calloc ceil clearerr clock cos cosh ctime difftime div exit exp fabs fclose feof ferror fflush fgetc fgetpos fgets floor fmod fopen fprintf fputc fputs fread free f…

Cの予約語

C

auto double int struct break else long switch case enum register typedef char exterm return union const float short unsigned continue for signed void default goto sizeof volatile do if static while

signal(2) signal(SIGINT, sig_handler);を試した。

とりあえずsignalのman結果。 SIGNAL(2) Linux Programmer’s Manual SIGNAL(2) 名前 signal - ANSI C シグナル操作 書式 #include <signal.h> typedef void (*sighandler_t)(int); sighandler_t signal(int signum, sighandler_t sighandler); 説明 signal() システム</signal.h>…

getopt(3)

C

オプション解析APIgetopt(3) #include <unistd.h> int getopt(int argc, char * const argv[], const char *optdecl); extern char *optarg; extern int optind, opterr, optopt; getopt(3)に関連したグローバル変数 型 名前 意味 char* optarg 現在処理中のオプション</unistd.h>…

UbuntuのOpenCOBOLでソースをCで出力

UbuntuのOpenCOBOLでソースをコンパイルして実行 - developer's diaryでコンパイルしたソースをCで出力するCにするソースは、http://www12.ocn.ne.jp/~peg/1_1.html#c10より。 IDENTIFICATION DIVISION. PROGRAM-ID. hello. PROCEDURE DIVISION. DISPLAY "He…

signal(SIGINT, sig_handler);をPHPで試した。

php C

cの場合*1 #include <stdlib.h> #include <signal.h> #include <unistd.h> static void sig_handler(const int sig) { printf("SIGINT handled.\n"); exit(EXIT_SUCCESS); } int main (int argc, char **argv) { signal(SIGINT, sig_handler); sleep(60); } 実行結果 [user@localhost ~]$ .</unistd.h></signal.h></stdlib.h>…

C言語って何。

C

薄いグルーです。 古典的なアーキテクチャに薄く被せたレイヤーがC言語及びC++なのです。 古典的なアーキテクチャ バイナリ表現 フラットなアドレス空間 メモリとワーキングセット 汎用レジスタ 固定長バイトへのアドレス解決 2アドレス命令 ビッグエンディ…