Gaudi Framework, version v25r2

Home   Generated: Wed Jun 4 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Functions
main.cpp File Reference
#include "Python.h"
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 8 of file main.cpp.

{
if (argc < 2 ) {
std::cout << "ERROR: insufficient command arguments" << std::endl;
return 0;
}
Py_Initialize();
// Get the Python version
std::string fullversion = Py_GetVersion();
std::string version( fullversion, 0, fullversion.find_first_of(' '));
std::string vers(version, 0, version.find_first_of('.',version.find_first_of('.')+1));
std::cout << "Python version: [" << vers << "]" << std::endl;
// Startup commands
PyRun_SimpleString( "print dir()" );
std::cout << "Running now: " << argv[1] << std::endl;
std::ifstream file(argv[1]);
std::stringstream str;
if( file ) {
char ch;
while( file.get(ch) ) str.put(ch);
PyRun_SimpleString( const_cast<char*>(str.str().c_str()) );
file.close();
}
else {
std::cout << "ERROR: could not open file " << argv[1] << std::endl;
}
std::cout << "Exiting now " << std::endl;
return 0 ;
}

Generated at Wed Jun 4 2014 14:48:58 for Gaudi Framework, version v25r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004