2006年10月19日 星期四 11:10
linux下不按文件名识别属性, 这个程序是典型的C 我做了一点小改动 [CODE] /* @Title: * @Author: K.Ro * @Date: * @Time: * @Version: 1.0 ************************ * Hitachi Ltd,.Co 2005 Tokyo Japan. */ #include#include #include #include #include #include const char* pystring = "import time\n" "print \"Today is \",time.ctime(time.time())\n"; /**************** MAIN ROUTINE *******************/ int main(int argc,char *argv[]/*,char **genv*/){ Py_Initialize(); PyRun_SimpleString(pystring); Py_Finalize(); return 0; } 下面是典型的C++写的: #include #include using namespace std ; const char* pystring = "import time\n" "print \"Today is \",time.ctime(time.time())\n"; // ----------- Main ------------- int main(void){ Py_Initialize(); PyRun_SimpleString(pystring); Py_Finalize(); cout << "End." << endl; return 0; } ------------------------ 编译: g++ Pytest.cpp -o Pytest -I/usr/include/python2.4 -L/usr/lib/ -lpython2.4 gcc Pytest.cpp -o Pytest -I/usr/include/python2.4 -L/usr/lib/ -lpython2.4 我的环境都可以 2006/10/19, Jin Qing jinq0123在163.com: > > > > 我试的是Python2.2的。 > > 另外,*.C文件是C++源程序,应该用g++的,gcc不能编译。 > > > -- > -- Jia LU > <http://www.lujia.us> > python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for p > in '001akor在liamg.moc'.split('@')])" > -- > \ "Unix is an operating system, OS/2 is half an operating system, | > `\ Windows is a shell, and DOS is a boot partition virus." -- | > _o__) Peter H. Coffin | -------------- 下一部分 -------------- 一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20061019/f5df5d61/attachment.html
Zeuux © 2025
京ICP备05028076号