- FileSelectDialog
- FileFindFirst
- FileFindNext
- FileFindClose
- FileIsExist
- FileOpen
- FileClose
- FileCopy
- FileDelete
- FileMove
- FileFlush
- FileGetInteger
- FileIsEnding
- FileIsLineEnding
- FileReadArray
- FileReadBool
- FileReadDatetime
- FileReadDouble
- FileReadFloat
- FileReadInteger
- FileReadLong
- FileReadNumber
- FileReadString
- FileReadStruct
- FileSeek
- FileSize
- FileTell
- FileWrite
- FileWriteArray
- FileWriteDouble
- FileWriteFloat
- FileWriteInteger
- FileWriteLong
- FileWriteString
- FileWriteStruct
- FileLoad
- FileSave
- FolderCreate
- FolderDelete
- FolderClean
FileReadInteger
The function reads int, short or char value from the current position of the file pointer depending on the length specified in bytes.
int FileReadInteger(
|
Parameters
file_handle
[in] File descriptor returned by FileOpen().
size=INT_VALUE
[in] Number of bytes (up to 4 inclusive) that should be read. The corresponding constants are provided: CHAR_VALUE = 1, SHORT_VALUE = 2 and INT_VALUE = 4, so the function can read the whole value of char, short or int type.
Return Value
A value of the int type. The result of this function must be explicitly cast to a target type, i.e. to the type of data that you need to read. Since a value of the int type is returned, it can be easily converted to any integer value. The file pointer is shifted by the number of bytes read.
Note
When reading less than 4 bytes, the received result is always positive. If one or two bytes are read, the sign of the number can be determined by explicit casting to type char (1 byte) or short (2 bytes). Getting the sign for a three-byte number is not trivial, since there is no corresponding underlying type.
Example (the file obtained after executing the example for FileWriteInteger function is used here)
//+------------------------------------------------------------------+
|
See also
IntegerToString, StringToInteger, Integer types, FileWriteInteger