Question about file seeking position

后端 未结 3 510
陌清茗
陌清茗 2021-01-15 00:17

My previous Question is about raw data reading and writing, but a new problem arised, it seems there is no ending....

The question is: the parameters of the function

3条回答
  •  抹茶落季
    2021-01-15 01:00

    The offset parameter of lseek is of type off_t. In 32-bit compilation environments, this type defaults to a 32-bit signed integer - however, if you compile with this macro defined before all system includes:

    #define _FILE_OFFSET_BITS 64
    

    ...then off_t will be a 64-bit signed type.

    For fseek, the fseeko function is identical except that it uses the off_t type for the offset, which allows the above solution to work with it too.

提交回复
热议问题