Glotzilla Terminal
#include GLOTZILLA_TERMINAL
The glotzilla terminal is automatically declared when you include the GLOTZILLA_TERMINAL header file.
Executing a Command
glotzilla::terminal.execute("rm /Volumes/Storage/glotzilla/output/run1/*.dat");
if(!glotzilla::terminal.fail()) //checks if the command was executed
glotzilla::terminal.printResult(); //prints the result to the stdout
else
glotzilla::terminal.showError(); //prints the error to stderr
Using the Result
The output from the unix command is captured as an array of strings. You can access the output of the unix command via glotzilla::terminal.result.
glotzilla::terminal.execute("ls /Volumes/Storage/glotzilla/output/run1/*.dat");
for(i=0; i<glotzilla::terminal.result.length(); i++) //loop over all lines returned
{
if(glotzilla::terminal.result[i] == "lost_file.txt")
{
cout << "found file!"<<endl;
exit 0;
}
}
Capturing Output
This does the same thing as the previous code.
glotzilla::terminal.execute("ls /Volumes/Storage/glotzilla/output/run1/*.dat");
glotzilla::container <std::string> lsResult = glotzilla::terminal.result;
for(i=0; i<lsResult.length(); i++) //loop over all lines returned
{
if(lsResult[i] == "lost_file.txt")
{
cout << "found file!"<<endl;
exit 0;
}
}