txt 1
2
3
4
5
6
7
8
9
10
// Save
FString Content = "xxx" ;
FString FileName = FPaths :: ProjectIntermediateDir () + "xxx/xxx.txt" ;
FFileHelper :: SaveStringToFile ( Content , * FileName , FFileHelper :: EEncodingOptions :: ForceUTF8WithoutBOM );
// Load
TArray < FString > OutStrings ;
if ( FFileHelper :: LoadANSITextFileToStrings ( * FilePath , nullptr , OutStrings ))
{
}
json https://www.cnblogs.com/shiroe/p/14751769.html
ini https://dev.epicgames.com/documentation/zh-cn/unreal-engine/configuration-files-in-unreal-engine?application_version=5.4
xml 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "XmlFile.h"
FString OutputFilePath = FPaths :: ProjectIntermediateDir () + "xxx/xxx.xml" ;
const FString XmlTemplate = "<?xml version= \" 1.0 \" encoding= \" UTF - 8 \" ?> \n <root> \n </root>" ;
FXmlFile * XmlFile = new FXmlFile ( XmlTemplate , EConstructMethod :: ConstructFromBuffer );
if ( ! XmlFile -> IsValid ())
return 0 ;
FXmlNode * XmlRoot = XmlFile -> GetRootNode ();
if ( XmlRoot == nullptr )
return 0 ;
// 添加
XmlRoot -> AppendChildNode ( xxx );
XmlFile -> Save ( OutputFilePath );
delete XmlFile ;
excel 保存数据的类:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
USTRUCT ()
struct FAssetLockedTable : public FTableRowBase
{
GENERATED_BODY ()
UPROPERTY ( EditAnywhere )
FString PackageName ;
UPROPERTY ( EditAnywhere )
FString ReferencerName ;
UPROPERTY ( EditAnywhere )
FString OtherUserCheckedOutName ;
};
保存cpp代码:
1
2
3
4
5
6
7
8
9
10
UDataTable * DataTable = NewObject < UDataTable > ();
DataTable -> RowStruct = FAssetLockedTable :: StaticStruct ();
FAssetLockedTable RowData ;
RowData . PackageName = "1" ;
RowData . ReferencerName = "2" ;
RowData . OtherUserCheckedOutName = "3" ;
DataTable -> AddRow ( FName ( "hebohang" ), RowData );
const FString CSVString = DataTable -> GetTableAsCSV ();
FString CsvPath = FPaths :: ProjectIntermediateDir () + TEXT ( "Test/AssetLockedTable.csv" );
FFileHelper :: SaveStringToFile ( CSVString , * CsvPath , FFileHelper :: EEncodingOptions :: ForceUTF8 );
生成 excel:
Licensed under CC BY-NC-SA 4.0