1.2.7.4.23 SYS_FS_FilePrintf Function

C

SYS_FS_RESULT SYS_FS_FilePrintf
(
    SYS_FS_HANDLE handle,
    const char *string,
    ...
);

Summary

Writes a formatted string into a file.

Description

This function writes a formatted string into a file.

Precondition

The file into which a string has to be written, must exist and should be open.

Parameters

ParamDescription
handleFile handle to which formatted string is to be written.
stringPointer to formatted string which has to be written into file.

Returns

SYS_FS_RES_SUCCESS - Formatted string write operation was successful.

SYS_FS_RES_FAILURE - Formatted string write operation was unsuccessful. The reason for the failure can be retrieved with SYS_FS_Error or SYS_FS_FileError.

Example

SYS_FS_RESULT res;
SYS_FS_HANDLE fileHandle;

fileHandle = SYS_FS_FileOpen("/mnt/myDrive/FILE.txt", (SYS_FS_FILE_OPEN_WRITE_PLUS));

if(fileHandle != SYS_FS_HANDLE_INVALID)
{
    // File open is successful
}

// Write a string
res = SYS_FS_FilePrintf(fileHandle, "Hello World %d", 1234);

if( res != SYS_FS_RES_SUCCESS)
{
    // write operation failed.
}

Remarks

None.