Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS+ Products FreeRTOS Labs Integration Services Contact / Enquiries

f_findfirst()

[FreeRTOS Embedded File System API]

header_file.h
unsigned char f_findfirst( const char *pcFileName, F_FIND *pxFindStruct );
		

Finds the first file or directory in a FAT file system directory. Call f_findfirst() to find the first file or directory, then f_findnext() to find subsequent files and directories.

Parameters:

pcFileName   Name/path of the files to find (see the example below).

pxFindStruct   A structure in which the 'find' information is stored.

Returns:
F_NO_ERROR   The call to f_findfirst() was successful and pxFindStruct was populated.

Any other value   The call to f_findfirst() was not successful. The return value holds the error code.

See also

f_findnext().

Example usage:


void vAFunction( void )
{
F_FIND xFindStruct;

    /* Print out information on every file in the subdirectory "subdir". */
    if( f_findfirst( "/subdir/*.*", &xFindStruct ) == F_NO_ERROR )
    {
        do
        {
            printf( filename:%s, xFindStruct.filename );

            if( ( xFindStruct.attr & F_ATTR_DIR ) != 0 )
            {
                printf ( "is a directory directory\r\n" );
            }
            else
            {
                printf ( "is a file of size %d\r\n", xFindStruct.filesize );
            }

        } while( f_findnext( &xFindStruct ) == F_NO_ERROR );
    }
}
						
Example use of the f_findfirst() API function


[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS+ Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]


Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.