LoginSignup
1
1

More than 5 years have passed since last update.

ファイルの中身をStringで返す #UE4 #CPP

Last updated at Posted at 2017-02-10

ファイルの中身を返す

Source

FileInfo.h
// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "FileInfo.generated.h"

/**
 * 
 */
UCLASS()
class CPPSAMPLE_API UFileInfo : public UBlueprintFunctionLibrary
{
    GENERATED_BODY()

public :
    UFUNCTION(BlueprintCallable, Category = "MyBPLibrary")
    static FString FileLoadStr(FString CompleteFilePath);



};
FileInfo.cpp
// Fill out your copyright notice in the Description page of Project Settings.

#include "CPPSample.h"
#include "FileInfo.h"

FString UFileInfo::FileLoadStr(FString CompleteFilePath)
{
    FString FileData = "";
    FFileHelper::LoadFileToString(FileData, *CompleteFilePath);
    return FileData;
}

組み合わせる

UE4 CPP ファイル一覧を取得して配列に格納するブループリントの作成
http://qiita.com/gansaibow/private/7dee2f3d61af9bd8b37f

指定したディレクトリ配下のTextファイルの文字列を出力する

image

参考URL

FFileHelper::LoadFileToString
https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Misc/FFileHelper/LoadFileToString/index.html

Reading Text File Line by Line
https://answers.unrealengine.com/questions/81697/reading-text-file-line-by-line.html

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1