Jump to main content

##

# 1.2.7.4.18 SYS_FS_FileStringPut Function

## C

    SYS_FS_RESULT SYS_FS_FileStringPut
    (
        SYS_FS_HANDLE handle,
        const char *string
    );

## Summary

Writes a string to a file.

## Description

This function writes a string into a file. The string to be written should be NULL terminated. The terminator character will not be written.

## Precondition

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

## Parameters

Param | Description
--- | ---
handle | File handle to which string is to be written.
string | Pointer to the null terminated string which has to be written into file.

## Returns

SYS_FS_RES_SUCCESS - String write operation was successful.

SYS_FS_RES_FAILURE - 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_FileStringPut(fileHandle, "Hello World");

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

## Remarks

None.