[ ]
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT FreeRTOS+POSIX Contact / Enquiries


FreeRTOS+FAT is still in the lab
FreeRTOS+FAT is already in use in commercial products and we encourage you to try it yourself. Be aware however that FreeRTOS+FAT was acquired by Real Time Engineers Ltd., and is still being documented and updated to ensure it meets our strict quality standards. Please use the forum for support, or contact us directly if you have a specific business interest.

ff_fprintf()

[FreeRTOS+FAT Standard API Reference]

ff_stdio.h
size_t ff_fprintf( FF_FILE * pxStream, const char *pcFormat, ... );
		

Writes formatted data to a file in exactly the same way sprintf() writes formatted data to a buffer, or printf() writes formatted data to a console.

ff_fprintf() calls vsnprintf(), which must be provided by your C library for a project that uses ff_fprintf() to link. The format specifiers and extensions (for example "%02D", "%s", etc.) that are available for use will depend on your C library.

FF_FPRINTF_SUPPORT must be set to 1 in FreeRTOSFATConfig.h for ff_fprintf() to be available.

Note: ff_fprintf() is quite a heavy function as it allocates memory into which it writes is formatted data before outputting the data to the file. It also uses vsnprintf(), which can result in lots of additional library code being included in your project.

Parameters:

pxStream   A pointer to the file to which the formatted data is being written. This is the same pointer that was returned from the call to ff_fopen() used to originally open the file.

pcFormat   The format string, which is used in exactly the same way as the format string input to a printf() call. The format specifiers that are available for use will depend on the C library in use.

...   A variable list of argument values - with one value for each specifier included in the format string.

Returns:

If ff_printf() could not allocate a buffer then 0 is returned.

If data was written to the file then number number of bytes written is returned.

If there was a write error then -1 is returned and the task's errno is set to indicate the reason. A task can obtain its errno value using the ff_errno() API function.

Example usage:

The example provided on the ff_fgets() documentation page shows how ff_fprintf() is used.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ FreeRTOS Labs Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.