You may want to write the results of your work to a file and/or read some data from a file.
3DCoat can do that. Use these commands:
File a( "a.txt" );
if ( a.exists() ) {
}
File a( "a.data" );
a.binary( true );
a.binary( false );
bool r = a.binary();
File a( "a.txt" );
string ext = a.extension();
File a( "my/folder/a.txt" );
string fullPath = a.fullPathFile();
File a( "my/folder/a.txt" );
string path = a.path();
File a( "a.txt" );
a = "Line for demo...\n"
"and yet one, yes!";
File a( "a.txt" );
a += "Line for demo...\n"
"and yet one, yes!";
File a( "a.bin" );
FormatBinary bin = { 0x46, 0x4c, 0x49, 0x46 };
a = bin;
File a( "a.bin" );
FormatBinary bin = { 0x46, 0x4c, 0x49, 0x46 };
a += bin;
File a( "a.txt" );
a.remove();
You may also need to open a dialog window for file selection. Here's the list of functions available:
DEPRECATED bool OpenDialog(string &in extensions,string &out result);
DEPRECATED bool SaveDialog(string &in extensions,string &out result);
DEPRECATED bool FolderDialog(string &out result);
DEPRECATED void SetFileForFileDialogs(string &in name);
DEPRECATED bool FileDialogCancelPressed();
Also if you prefer functional programing you may use these functions for files operations:
DEPRECATED void Execute(const string& command, const string& parameters);
void main() {
string instPath = installPath();
string userFolder = homePath();
string pythonInterpreter = "/usr/bin/env python";
string pythonScript = userFolder + "/bin/testLauncher";
string arg = "-f " + "\"" + instPath + "\"";
string app = pythonInterpreter + " " + pythonScript;
print(app + "\n" + arg + "\n");
Execute(app, arg);
}
DEPRECATED string ReadFromFile(const string& filename);
DEPRECATED void WriteToFile(const string& filename,const string& text,bool append);
DEPRECATED bool CheckIfFileExists(const string& filename);
DEPRECATED void RemoveFile(const char* filename);
DEPRECATED string RemoveFilePath(string &in s);
DEPRECATED string RemoveExtension(string &in s);
DEPRECATED string EnsureAbsolutePth(string &in s);
DEPRECATED string GetFilePath(string &in s);
DEPRECATED string GetFileExtension(string &in s);
DEPRECATED string GetFileName(string &in s);
DEPRECATED bool CheckIfExists(string &in s);
DEPRECATED void CreatePath(string &in s);
DEPRECATED void ForEachFileInFolder(string &in Folder,string &in ExtList,string &in Callback);
string installPath();
string rwPath( const string& userPath );
string homePath();