Jump to main content

##

# 1.2.7.4.22 SYS_FS_FileCharacterPut Function

## C

    SYS_FS_RESULT SYS_FS_FileCharacterPut
    (
        SYS_FS_HANDLE handle,
        char data
    );

## Summary

Writes a character to a file.

## Description

This function writes a character to a file.

## Precondition

The file into which a character has to be written, has to be present and should have been opened.

## Parameters

Param | Description
--- | ---
handle | file handle to which the character is to be written.
data | character to be written to the file.

## Returns

SYS_FS_RES_SUCCESS - Write operation was successful.

SYS_FS_RES_FAILURE - 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 character to the file.
    res = SYS_FS_FileCharacterPut(fileHandle, 'c');

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

## Remarks

None.