最近做项目,使用VSIFOpenL 读写影像大文件,由于涉及到按行读取和按字节读取的问题,使用GDAL自带的读写函数操作比较麻烦,于是混用了C的读写函数fgets fread与VSIFOpenL ,出现了内存出错的情况。查询VSIFOpenL 官网发现自己的问题:
VSILFILE * VSIFOpenL (const char *, const char *) CPL_WARN_UNUSED_RESULT
Open file.
This function opens a file with the desired access. Large files (larger than 2GB) should be supported. Binary access is always implied and the "b" does not need to be included in the pszAccess string.