代码拉取完成,页面将自动刷新
#include "client.h"
void transread(const char *host,const char *filepath,const char *targetdir,const char *uid,const char *gid,const char *position,const char *size)
{
Py_Initialize();
if(!Py_IsInitialized())
{
printf("can't initialize\n");
}
PyObject * pModule = NULL;
PyObject * pFunc = NULL;
PyObject * result = NULL;
PyRun_SimpleString("import sys");
PyRun_SimpleString("import os");
PyRun_SimpleString("import string");
PyRun_SimpleString("sys.path.append('./')");
PyObject *pArgs = PyTuple_New(7);
PyTuple_SetItem(pArgs,0,Py_BuildValue("s",host));
PyTuple_SetItem(pArgs,1,Py_BuildValue("s",filepath));
PyTuple_SetItem(pArgs,2,Py_BuildValue("s",targetdir));
PyTuple_SetItem(pArgs,3,Py_BuildValue("s",uid));
PyTuple_SetItem(pArgs,4,Py_BuildValue("s",gid));
PyTuple_SetItem(pArgs,5,Py_BuildValue("s",position));
PyTuple_SetItem(pArgs,6,Py_BuildValue("s",size));
printf("size is %s\n",size);
pModule = PyImport_ImportModule("client");
if(pModule == NULL)
{
printf("can't load module\n");
}
pFunc = PyObject_GetAttrString(pModule,"readentrance");
if(pFunc == NULL)
{
printf("can't load function\n");
}
result = PyEval_CallObject(pFunc,pArgs);
cout<<result<<endl;
Py_DECREF(pArgs);
if(result == NULL)
cout<<"null"<<endl;
Py_DECREF(result);
Py_Finalize();
//return 0;
}
void transupload(const char *host,const char *filepath,const char *targetdir)
{
Py_Initialize();
if(!Py_IsInitialized())
{
printf("can't initialize\n");
}
PyObject * pModule = NULL;
PyObject * pFunc = NULL;
PyObject * result = NULL;
PyRun_SimpleString("import sys");
PyRun_SimpleString("import os");
PyRun_SimpleString("import string");
PyRun_SimpleString("sys.path.append('./')");
PyObject *pArgs = PyTuple_New(3);
PyTuple_SetItem(pArgs,0,Py_BuildValue("s",host));
PyTuple_SetItem(pArgs,1,Py_BuildValue("s",filepath));
PyTuple_SetItem(pArgs,2,Py_BuildValue("s",targetdir));
pModule = PyImport_ImportModule("client");
// printf("host %s",host);
if(pModule == NULL)
{
printf("can't load module\n");
}
pFunc = PyObject_GetAttrString(pModule,"uploadentrance");
if(pFunc == NULL)
{
printf("can't load function\n");
}
result = PyEval_CallObject(pFunc,pArgs);
Py_DECREF(pArgs);
if(result == NULL)
cout<<"null"<<endl;
Py_DECREF(result);
Py_Finalize();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。