FFileHelper

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Misc/FileHelper.h

Include

#include "Misc/FileHelper.h"

Syntax

struct FFileHelper

Functions

Name Description

Public function Static

void

 

BufferToString

(
    FString& Result,
    const uint8* Buffer,
    int32 Size
)

Load a text file to an FString.

Public function Static

bool

 

CreateBitmap

(
    const TCHAR* Pattern,
    int32 DataWidth,
    int32 DataHeight,
    const FColor* Data,
    FIntRect* SubRectangle,
    IFileManager* FileManager,
    FString* OutFilename,
    bool bInWriteAlpha,
    EColorChannel ColorChannel
)

Saves a 24/32Bit BMP file to disk

Public function Static

void

 

GenerateDateTimeBasedBitmapFilename

(
    const FString& Pattern,
    const FString& Extension,
    FString& OutFilename
)

Generates the next unique bitmap filename with a specified extension

Public function Static

bool

 

GenerateNextBitmapFilename

(
    const FString& Pattern,
    const FString& Extension,
    FString& OutFilename,
    IFileManager* FileManager
)

Generates the next unique bitmap filename with a specified extension

Public function Static

bool

 

IsFilenameValidForSaving

(
    const FString& Filename,
    FText& OutError
)

Checks to see if a filename is valid for saving.

Public function Static

bool

 

LoadANSITextFileToStrings

(
    const TCHAR* InFilename,
    IFileManager* InFileManager,
    TArray< FString >& OutStrings
)

Load the given ANSI text file to an array of strings - one FString per line of the file.

Public function Static

bool

 

LoadFileToArray

(
    TArray64< uint8 >& Result,
    const TCHAR* Filename,
    uint32 Flags
)

Load a binary file to a dynamic array with two uninitialized bytes at end as padding.

Public function Static

bool

 

LoadFileToArray

(
    TArray< uint8 >& Result,
    const TCHAR* Filename,
    uint32 Flags
)

Load a binary file to a dynamic array with two uninitialized bytes at end as padding.

Public function Static

bool

 

LoadFileToString

(
    FString& Result,
    FArchive& Reader,
    EHashOptions VerifyFlags
)

Load a text file to an FString.

Public function Static

bool

 

LoadFileToString

(
    FString& Result,
    const TCHAR* Filename,
    EHashOptions VerifyFlags,
    uint32 ReadFlags
)

Load a text file to an FString.

Public function Static

bool

 

LoadFileToString

(
    FString& Result,
    IPlatformFile* PlatformFile,
    const TCHAR* Filename,
    EHashOptions VerifyFlags,
    uint32 ReadFlags
)

Load a text file to an FString.

Public function Static

bool

 

LoadFileToStringArray

(
    TArray< FString >& Result,
    const TCHAR* Filename
)

Load a text file to an array of strings.

Public function Static

bool

 

LoadFileToStringArrayWithPredicate

(
    TArray< FString >& Result,
    const TCHAR* Filename,
    TFunctionRef< bool&)...
)

Load a text file to an array of strings, filtered by a user-defined predicate.

Public function Static

bool

 

LoadFileToStringWithLineVisitor

(
    const TCHAR* Filename,
    TFunctionRef< voidLine)...
)

Load a text file and invoke a visitor for each line.

Public function Static

bool

 

SaveArrayToFile

(
    TArrayView< const uint8 > Array,
    const TCHAR* Filename,
    IFileManager* FileManager,
    uint32 WriteFlags
)

Save a binary array to a file.

Public function Static

bool

 

SaveArrayToFile

(
    const TArray64< uint8 >& Array,
    const TCHAR* Filename,
    IFileManager* FileManager,
    uint32 WriteFlags
)

Save a binary array to a file.

Public function Static

bool

 

SaveStringArrayToFile

(
    const TArray< FString >& Lines,
    const TCHAR* Filename,
    EEncodingOptions EncodingOptions,
    IFileManager* FileManager,
    uint32 WriteFlags
)

Write the FString to a file.

Public function Static

bool

 

SaveStringToFile

(
    FStringView String,
    const TCHAR* Filename,
    EEncodingOptions EncodingOptions,
    IFileManager* FileManager,
    uint32 WriteFlags
)

Write the FString to a file.

Enums

Deprecated Functions

Name Description

Public function Static

bool

 

CreateBitmap

(
    const TCHAR* Pattern,
    int32 DataWidth,
    int32 DataHeight,
    const FColor* Data,
    FIntRect* SubRectangle,
    IFileManager* FileManager,
    FString* OutFilename,
    bool bInWriteAlpha,
    EChannelMask ChannelMask
)

EChannelMask has been deprecated in favor of EColorChannel, please use the other CreateBitmap() method.

Public function Static

bool

 

LoadFileToStringArray

(
    TArray< FString >& Result,
    const TCHAR* Filename,
    EHashOptions VerifyFlags
)

LoadFileToStringArray no longer supports VerifyFlags. You can use UE::String::ParseLines to split up a string loaded with LoadFileToString

Public function Static

bool

 

LoadFileToStringArrayWithPredicate

(
    TArray< FString >& Result,
    const TCHAR* Filename,
    TFunctionRef< bool&)...,
    EHashOptions VerifyFlags
)

LoadFileToStringArrayWithPredicate no longer supports VerifyFlags. You can use UE::String::ParseLines to split up a string loaded with LoadFileToString