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++¹¤³
Ïà¹ØÎÊ´ð£º
ÎÊһϣº
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......
ÏÈ¿´Ò»¸ö³ÌÐò
#include <stdio.h>
int main()
{
const int a = 5;
int b[a];
return 0;
}
ÔÚvc6.0ÖÐÃüÃûΪ.cÎļþ£¬±àÒë»á³ö´í£¬ÊÇint b[a]ÕâÒ»ÐУºexpected constant exp ......
pythonºÍpyqtÒÔ¼°Eric4¶¼ÒѾÅäÖúÃÁË£¬´ò¿ªEric4д¸öpython³ÌÐò±ÈÈç¼òµ¥µÄ
print¡°hello£¬world¡±£¬Ôõô±àÒëÔËÐÐÁË£¬Start²Ëµ¥µÄËùÓÐÃüÁî¶¼³öÏÖºÍͼÖв¶àµÄ¶Ô»°¿ò£¬Ó¦µ±ÔõôÔËÐÐÁË£¿
Çó´ó¼ÒÖ¸½Ì
ûÓÐÈËÓà ......
±¾ÎÄÕª×Ô¡¶¿É°®µÄPython¡·¡°¹âÅ̹ÊÊ¡±CDay-1 ʵÓû¯ÖÐÎÄ¡£
[img]http://t.douban.com/mpic/s3901817.jpg[/img]
CDay-1 ʵÓû¯ÖÐÎÄÖÐÎÄ´¦Àí£¬Íê³É¹¦ÄܵÄʵÓû¯
ÄãÅöµ½99%µÄÎÊÌ⣬ÆäËûÈË֮ǰÒѾÓöµ½¹ýÁË£¬Ë ......
ÎÊÌâÒ»£º
ÔÚ¶ÔÆëΪ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 ......