FAT | RFS | XFS
printf()
PROTOTYPE
#include <stdio.h>
int printf(const char *format, ...);
DESCRIPTION
printf() writes formatted text to the open regular file identified by stdout at its current position, or end if open in append mode. format and any following arguments are interpreted according to Standard C’s output format string conventions.
If successful, printf() updates the file’s status change and data modification timestamps, marks its metadata as dirty, advances its current position, and returns the number of characters written. Otherwise, it sets errno and returns a negative value.
ERROR CODES
| EBADF | stdout is not the handle of a file open in write or append mode. |
| EFAULT | format equals NULL. |
| ENOSPC | The volume is full. |
EXAMPLE
/*-----------------------------------------------------------------*/
/* Write simple message to output. */
/*-----------------------------------------------------------------*/
if (printf("Hello World!\n") == -1)
{
perror("error writing string to output");
return -1;
}