int FileWriteInteger(int handle, int value, int size=LONG_VALUE)
The function writes the integer value to a binary file. If the size is
SHORT_VALUE, the value will be written as a 2-byte integer (the short type),
if the size is CHAR_VALUE, the value will be written as a 1-byte integer
(the char type), and if the size is LONG_VALUE, the value will be written
as a 4-byte integer (the long int type).
この関数は整数の値をバイナリ ファイルに書き込みます。サイズが SHORT_VALUE の場合、値は 2バイトの整数(short型)で書き込まれます。サイズが
CHAR_VALUE の場合は、値は 1バイトの整数(char型)で書き込まれます。サイズが LONG_VALUE の場合は、値は 4バイトの整数(long
int型)で書き込まれます。
Returns the actually written bytes count or a negative value if an error occurs.
エラーが発生した場合は、実際に書き込んだバイト数か、負の値を返します。
To get the detailed error information, one has to call the GetLastError() function.
詳細なエラー情報を取得するには、GetLastError()
関数を呼び出します。
Parameters:
パラメータ:
handle - File handle returned by the FileOpen() function.
FileOpen() 関数によって返されたファイル ハンドル。
value - Value to be written.
書き込む値。
size - Optional format flag. It can be any of the following values:
オプション形式フラグ。値は次のいずれかを指定できます。
CHAR_VALUE (1 byte),
CHAR_VALUE (1 バイト)
SHORT_VALUE (2 bytes),
SHORT_VALUE (2 バイト)
LONG_VALUE (4 bytes, default).
LONG_VALUE (4 バイト、規定値)
Sample:
サンプル:
int handle;
int value=10;
handle=FileOpen("filename.dat", FILE_BIN|FILE_WRITE);
if(handle<1)
{
Print("can't open file error-",GetLastError());
return(0);
}
FileWriteInteger(handle, value, SHORT_VALUE);
//...
FileClose(handle);
|