Download FreeRTOS
 

Quality RTOS & Embedded Software

LIBRARIES
WHAT'S NEW
Simplifying Authenticated Cloud Connectivity for Any Device.
Designing an energy efficient and cloud-connected IoT solution with CoAP.
Introducing FreeRTOS Kernel version 11.0.0:
FreeRTOS Roadmap and Code Contribution process.
OPC-UA over TSN with FreeRTOS.

stdioGET_ERRNO()

[FreeRTOS-Plus-FAT Standard API Reference]

ff_stdio.h
static portINLINE int stdioGET_ERRNO( void );
  File related functions in the standard C library often return 0 for pass, and -1 for fail. If -1 is returned then the reason for the failure is stored in a variable called errno, which must be inspected separately. FreeRTOS-Plus-FAT's standard stdio style interface maintains an errno variable for each RTOS task. static portINLINE() returns the errno value for the calling task. Notes:
  • The file system's C library style API uses the same errno values as used by the stanard C library. These are documented on a separate page.
  • The file system's native API has a more sophisticated error code system, and returns error codes directly from its API functions.
Example usage:

void vAFunction( FF_FILE *pxFile, long lOffset, int iWhence )
{
int iReturned;

/* Attempt to seek a file using the parameters passed into this function. */
iReturned = ff_fseek( pxFile, lOffset, iWhence );

if( iReturned == 0 )
{
/* The call to ff_fseek() passed. */
}
else
{
/* The call to ff_fseek() failed. Obtain the errno to see why. */
iReturned = stdioGET_ERRNO();

if( iReturned == pdFREERTOS_ERRNO_ESPIPE )
{
/* The seep position was illegal - outside of the file's space. */
}
else if( iReturned == pdFREERTOS_ERRNO_EINVAL )
{
/* The value of iWhence was not legal. */
}
}
}

Example use of the stdioGET_ERRNO() API function
 
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.