I want to have my program open a Python script as a string so it can be used by Py_RunSimpleString().
bool runscript(const char* pyname)
{
//Loads and runs a specified script
if(PHYSFS_exists(pyname)) //if the script exists
{
pyname = PHYSFS_openRead(pyname); //opens the script
PyRun_SimpleString( pyname ); //run the requested script. This is a temporary version, the final version will have low level embedding
return true;
}
else //if unable to open script
{
return false;
}
}
But PHYSFS_openRead() only returns data of type PhyFS_file. I can't find a Physics FS function that opens a file as a string. So, how would I get the file contents as a string.