Class: Stream
Lua
C++
Edit

Stream::WriteString

This method writes a string to the stream at the current position.

Syntax

Parameters

Name Description
s string to write
terminate if true an extra byte with a value of zero will be written at the end of the string

Example

#include "UltraEngine.h"

using namespace UltraEngine;

int main(int argc, const char* argv[])
{
    WString path = GetPath(PATH_DOCUMENTS) + "/temp.txt";

    //Write a new file
    auto stream = WriteFile(path);
    if (stream == NULL)
    {
        Print("Failed to write file.");
        return 0;
    }

    stream->WriteString("Hello, world!");
    stream->Close();

    stream = ReadFile(path);
    Print(stream->ReadString());

    return 0;
}
Copyright © 2024 Ultra Software.
All rights reserved.