/* -*- MaTX -*- * * 【名前】 * fwrite() - 行列をファイルにバイナリデータとして書き込む * * 【形式】 * c = fwrite(fd, X, type) * Integer c; * Integer fd; * (Matrix|Array|Index) X; * String type; * * 【機能説明】 * fwrite(fd, mat, type) は行列の成分を指定したファイルに指定 * したデータ型のバイナリで書き込む。データは行の順に書き込まれる。 * fd は関数 fopen() が返すファイルディスクリプタ,X は書き込む行列, * type は書き込むデータの型である。type には次に示す C 言語の * データの型を文字列で指定する。 * * "char" : 文字 (8 bits) * "signed char" : 符合あり文字 (8 bits) * "unsigned char" : 符合なし文字 (8 bits) * "short" : 整数 (16 bits) * "signed short" : 符合あり整数 (16 bits) * "unsigned short" : 符合なし整数 (16 bits) * "int" : 整数 (16,32,64 bits) * "signed int" : 符合あり整数 (16,32,64 bits) * "unsigned int" : 符合なし整数 (16,32,64 bits) * "long" : 整数 (32 bits) * "signed long" : 符合あり整数 (32 bits) * "unsigned long" : 符合なし整数 (32 bits) * "float" : 単精度浮動小数点数 (32 bits) * "double" : 倍精度浮動小数点数 (32 bits) * * 【例題】 * 行列 A を int 型のバイナリデータとして保存する * * A = [1 2 3 4 5]; * fd = fopen("data", "wb"); * fwrite(fd, A, "int"); * fclose(fd); * * 【関連項目】 * fopen(), fclose(), fscanf(), fgets(), fread() */