c++ÖÐǶÈëpythonÄ£¿éÖ¸ÕëΪ¿Õ,Ϊʲô
#include <Python.h>
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
vector <string> results;
PyObject *module,*liststr,*dic,*fun,*argss;
Py_ssize_t slen;
Py_Initialize();
if (!Py_IsInitialized())
{
cout < <"fail!" < <endl;
return 0;
}
//ÏÂÃæÕâ¾ä¶¼ÄÜÕý³£Ö´ÐУ¬ËµÃ÷»·¾³ÉèÖÃÓ¦¸ÃûÎÊÌâ
PyRun_SimpleString("print('hello')");
//ÕâÒÔºóµÄ¾Í²»ÐÐÁË£¬µ¼ÈëÄ£¿éÖ¸ÕëΪ¿Õ
module=PyImport_ImportModule("Helper");
if (!module)
{
return 0;
}
dic = PyModule_GetDict(module);
fun = PyDict_GetItemString(dic,"GetTokenizeResult");
argss = Py_BuildValue("(ss)","ds|fef|ggg|fes|fe","|");
liststr = PyObject_CallObject(fun,argss);
slen = PyList_Size(liststr);
for (int i=0;i <slen;i++)
{
string restr;
PyArg_Parse(PyList_GetItem(liststr,i),"s",&restr);
results.push_back(restr);
}
Py_Finalize();
return 0;
}
Çë´óÏÀÃǰïæ¿´¿´Ôõô»ØÊ£¬ÎÊÌâÔÚ´úÂë×¢ÊÍÖУ¬»·¾³vs2005 python3.0¶øÇÒÏîÄ¿ÖеÄ×Ö·û¼¯×öÁ˸÷ÖÖÉèÖû¹ÊDz»ÐУ¬ÎÒ°ÑpythonµÄpy,ºÍÉú³ÉµÄpycÎļþÒ»Æð¿½µ½c++¹¤³
Ïà¹ØÎÊ´ð£º
ÇëÎÊÓÃC»òC++ÈçºÎ±àдÇó½â3Dħ·½µÄ³ÌÐò£¬¸Ã´ÓºÎ¿ªÊ¼£¿
лл¸÷룬°ïæÌáµã½¨Òé°É¡£
http://www.mofang.net/code/176/182/6581.html
ÎÒÖ»ÄÜÍ»ÆÆ60Ã룡°¦¡£
ÎÒ¸Õ¹ý40Ãë
googleµÄandroidÖÐÓиöOpenGL ES + ......
ÇëÎʸ÷λ¸ßÊÖÈçºÎÓÃC/C++»ñµÃϵͳδ°²×°²¹¶¡
ºÃÏñºÜרҵµÄ¶«Î÷¡£¡£¡£
²é×¢²á±í
ÿ¸ö²¹¶¡Èç¹û°²×°Á˶¼»áÔÚ×¢²á±íÀïÃæµÇ¼Ç
ÇëÎÊÄܲ»ÄܸüÇåÎúЩ£¬ÎÒÏëÓÃc\c++²é³öÀ´£¬²»ºÃÒâ˼£¬ÎÒÊÇÐÂÊÖ¡£»¹ÍûÖ¸½Ì¡£Ð»
·ÖÖµ ......
×î½üÓÃpythonдһ¸ö³ÌÐò,×ÜÊÇÒì³£Í˳ö£¬µ«ÊÇȴû·¨ÓÃtry..exceptÀ´²¶×½
ÓÉÓÚû·¨·¢Í¼Æ¬£¬ËùÒÔ°ÑÏà¹ØµÄÐÅÏ¢´òÓ¡³öÀ´
Òì³£µÄÐÅÏ¢´óÖÂÈçÏ£º
python.exeÓöµ½ÎÊÌâÐèÒª¹Ø±Õ¡£ÎÒÃǶԴËÒýÆðµÄ²»±ã±íʾ±§Ç¸ ......
¸Õ½Ó´¥£¬¸Ð¾õ¹¦ÄܱȽÏÇ¿´ó£¬Ö÷ÒªÊÇÕ³ºÏÐԺ㬿ÉÒÔÓлú½áºÏÆäËûÓïÑÔ¡£µ«²»Ã÷°×ËüÖ÷ÒªÓ¦ÓÃÓÚʲôÁìÓò£¬Ö÷Òª×öÄÇ·½ÃæµÄ¶«¶«¡£¿ª·¢ERPϵͳÊÇ·ñ¿ÉÐУ¿
»ù±¾ÉÏʲô¶¼¿ÉÒÔ×ö
½ñÌìÈ¥¿´ÁËһϣ¬»ù±¾ÉÏʲô ......
ÎÊÌâÒ»£º
ÔÚ¶ÔÆëΪ4µÄÇé¿öÏÂ
struct BBB
{
long num£»
char *name;
short int data;
char ha;
short ba[5];
}*p;
p=0x1000000;
p+0x200=____;
(Ulong)p+0x200=____;
(char*)p+0x200=____;
¼ÙÉèÔÚ32λC ......