stdioGET_ERRNO()
ff_stdio.h
static portINLINE int stdioGET_ERRNO( void );
标准 C 库中的文件相关函数通常返回 0 表示成功,
-1 表示失败。如果返回 -1,则失败的原因
存储在名为 errno 的变量中,须单独检查。
FreeRTOS-Plus-FAT 的标准 stdio 样式接口为每项
RTOS 任务维护一个 errno 变量。static portINLINE() 返回
调用任务的 errno 值。
注意:
- 文件系统的 C 库样式 API 使用的 errno 值
与标准 C 库所用的相同。这些值
记录在单独的页面上。
- 文件系统的原生 API
具有更复杂的错误代码体系,并
直接从其 API 函数返回错误代码。
用法示例:
void vAFunction( FF_FILE *pxFile, long lOffset, int iWhence )
{
int iReturned;
iReturned = ff_fseek( pxFile, lOffset, iWhence );
if( iReturned == 0 )
{
}
else
{
iReturned = stdioGET_ERRNO();
if( iReturned == pdFREERTOS_ERRNO_ESPIPE )
{
}
else if( iReturned == pdFREERTOS_ERRNO_EINVAL )
{
}
}
}
Example use of the stdioGET_ERRNO() API function
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.