2009-03-09から1日間の記事一覧

一時ファイルを作ってファイル閉じたらすぐ削除

#include <windows.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <io.h> #include <fcntl.h> #include <share.h> char *make_tempfile(void *data, int len) { char *filnam; int fd; char tmpdirnam[_MAX_PATH]; char tmpfilnam[_MAX_PATH]; in…</share.h></fcntl.h></io.h></sys/stat.h></sys/types.h></string.h></stdlib.h></stdio.h></windows.h>

拡張ライブラリにリソースを埋め込む

#include <windows.h> #include "resource.h" #include "ruby.h" static HINSTANCE hDll; static VALUE get_rc(VALUE self) { VALUE str; HRSRC hRc; HGLOBAL hGm; LPVOID p; long size; hRc = FindResourceA(hDll, MAKEINTRESOURCEA(IDR_TEXT1), "TEXT"); if (hRc == N</windows.h>…

KAKASIを使う

エラー時の戻り値は空文字列かな。 #include <stdio.h> #include <stdlib.h> #include <errno.h> #include "libkakasi.h" int main() { char *argv[] = { "kakasi", "-isjis", "-JH", "-HK" }; char *p; if (kakasi_getopt_argv(4, argv) != 0) { perror("kakasi_getopt_argv()"); exit(1</errno.h></stdlib.h></stdio.h>…

一時ファイルを作ってファイル閉じたらすぐ削除 その2

fcloseを使ってみる。 #include <windows.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <io.h> #include <fcntl.h> #include <share.h> char *make_tempfile(void *data, int len) { char *filnam; int fd; char tmpdirnam[_MAX_PATH]; char tmpfilnam[…</share.h></fcntl.h></io.h></sys/stat.h></sys/types.h></string.h></stdlib.h></stdio.h></windows.h>