bool URWTxtFile::LoadTxt(FString FileNameA, FString& SaveTextA)
{
return FFileHelper::LoadFileToString(SaveTextA, *(FPaths::GameDir() + FileNameA));
}
bool URWTxtFile::SaveTxt(FString SaveTextB, FString FileNameB)
{
return FFileHelper::SaveStringToFile(SaveTextB, *(FPaths::GameDir() + FileNameB));
}
hello looking for a solutions how can i change the locations so i can get my file from e:/drive/temp/text/textfile.txt not the same folder as the gamedir folders can i change anything on the Fpaths thanks in advance
noob c++
Have you tried just using e:/drive/temp/text/textfile.txt
as the path you want to write to? That should work.
-Testy
yea is a blueprint function is only seaching in GameDir found another way around but still really wanna to change it to AsolutDir so i can call any txt file on my pc but still dont know how iam really new for this c++ coding
thanks for reply
So if you’re trying to get a file from your computer in C++, you should be able to write something like this:
FFileHelper::LoadFileToString(SaveTextA, *"e:/drive/temp/text/textfile.txt";)
And just get the file directly, instead of using FPaths
. The point of FPaths
is to help you get files from common places on any computer, regardless of installation location. If you know your file will always be at “e:/drive/temp/text/textfile.txt” then you could use what I posted above. Although you should know that using hard-coded absolute paths like that usually isn’t a good idea, especially when it is not even on the C: drive.