GameMonkey problem
Posted: Wed Sep 29, 2010 9:29 am
I have switched to GameMonkey recently because it's easier to compile and use it on my app. The implementation works, but somehow I'm stumbled with a problem which is reading the script from a file.
I have a test.gm file that contains the following script
and I use the following code to read the file and run the script
Unfortunately nothing happen. Supposingly it should print the word "yo".
However if I don't read the script from file and include it in the source code, it works like charm
can anyone spot any error from my code? thanks in advance.
I have asked the same question on GameMonkey forum and waited for days but the forum seems dead.
I have a test.gm file that contains the following script
Code: Select all
print(\"yo\");
Code: Select all
std::string s;
std::ifstream file;
file.open("test.gm");
while(!file.eof())
{ getline(file, s); }
file.close();
gm->ExecuteString(s.c_str());
However if I don't read the script from file and include it in the source code, it works like charm
Code: Select all
std::string str = "print(\"yo\");";
gm->ExecuteString(s.c_str());
I have asked the same question on GameMonkey forum and waited for days but the forum seems dead.