¡¾ÇóÖú¡¿C++ÈçºÎ²¶»ñPythonÖеÄÒì³£
C++Öе÷ÓÃpythonº¯Êý£¬·¢ÏÖpythonº¯ÊýµÄÒì³£ÔÚC++ÖÐÎÞ·¨²¶»ñ¡£
µ÷Óú¯ÊýÈçÏ£¬Çë´óÏÀ½â»ó
unsigned long CPythonHelper::Execute(const std::string& mml_cmd,
unsigned char flag,
bool is_quick_cfg,
cm_mit_chk_rst& mit_chk_rst,
bool need_check_license,
unsigned int scene,
std::string user_name,
unsigned int user_type)
{
mutex::scoped_lock lock(_py_helper_mutex, true);
try
{
CPyObjList pyObjLst, pyDisRules;
CPyObjArray PyArr(7);
CPyObject pyRetObj, pyCmdPara;
PyArr.SetItem(0, mml_cmd);
PyArr.SetItem(1, flag);
PyArr.SetItem(2, (int)is_quick_cfg);
PyArr.SetItem(3, user_name);
PyArr.SetItem(4, (int)user_type);
PyArr.SetItem(5, (int)need_check_license);
PyArr.SetItem(6, (int)scene);
m_pyParser.ExecFunction("Execute", PyArr, pyObjLst); --pythonÅ׳öµÄÒì³££¬C++²¶»ñ²»µ½£¬²»ÖªµôΪºÎ
if (!get_mit_chk_rst(pyObjLst, mit_chk_rst))
&nb
Ïà¹ØÎÊ´ð£º
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
pythonµÄPIL¿â×Ô´øµÄ·½·¨Ö»ÄܽøÐоØÐεÄÇиÈç¹ûÎÒÓÐÁËÒ»¸ö¶à±ßÐθ÷¸ö¶¥µãµÄ×ø±ê£¬ÈçºÎ¶ÔÏÖÓеÄͼƬ°´ÕÕÕâ¸ö¶à±ßÐνøÐÐÇиîÄØ£¿
²»Ò»¶¨ÒªÓÃPIL¿â£¬ÈκÎÄÜʵÏÖÕâ¸ö¹¦Äܵķ½·¨¶¼ÐС£
ͼƬÇиîµÄjs²»ÊǺܶàÂð£¿
......
CÓïÑÔ±à³Ì ´Ó¼üÅÌÉÏÊäÒ»¸öµ¥´Ê Åжϵ¥´ÊÊÇ·ñÔÚ´Ê¿âÓУ¬´Ê¿âÊÇÒ»¸öÎı¾¡£
scanf("%c",&c);
if()ÅжϾÍÐÐÁË¡£
ÇÀSF¡£
дµÄ¶Ì
ÒýÓÃ
scanf("%c",&c);
if()ÅжϾÍÐÐÁË¡£
ÇÀSF¡£
......
ÇëÎʸßÊÖ£¬pythonÀïµÄpopenÀàËÆjavaÀïµÄÄĸöÀà»òÕß·½·¨ÄØ£¿£¿ÁíÍâjython¿ª·¢java¸ÃÈçºÎʹÓÃjythonÄØ£¿£¿
1.¿ÉÄܺÍjavaÀïµÄRuntime.getRuntime().exec£¨"ϵͳÃüÁî"£©; Æô¶¯½ø³Ì
2.eclipseÏÂÔØjython ²å¼ ......
±ÈÈçµ±³ÌÐò³öÏֶδíÎóʱ£¬ÈçºÎÈóÌÐòÖØÐ¿ªÊ¼£¬¶ø²»ÊDZ»ÏµÍ³ÖÕÖ¹¡£
ÄãÏëÒì³£´¦ÀíÂð£¿
C²»Ö§³Ö¡£
ÔÙ˵£¬Òì³£ºÍ´íÎóÊDz»Í¬µÄ¡£
¶Î´íÎó¾ÍÓ¦¸ÃÖÕÖ¹¡£
assert()
abort()
exit()
µ±³ÌÐò³öÏֶδíÎóʱ,ÎÞ· ......