23 lines
420 B
C
23 lines
420 B
C
|
#define PY_SSIZE_T_CLEAN
|
||
|
#include <Python.h>
|
||
|
|
||
|
static char script[] = "import time\n"
|
||
|
"import os\n"
|
||
|
"\n"
|
||
|
"print(\"Process ID: {}\".format(os.getpid()))\n"
|
||
|
"print(\"Entering infinite loop ...\")\n"
|
||
|
"while 1:\n"
|
||
|
" time.sleep(2)\n"
|
||
|
"\n";
|
||
|
|
||
|
int
|
||
|
main(int argc, char *argv[])
|
||
|
{
|
||
|
Py_Initialize();
|
||
|
PyRun_SimpleString(script);
|
||
|
if (Py_FinalizeEx() < 0) {
|
||
|
exit(120);
|
||
|
}
|
||
|
return 0;
|
||
|
}
|