python转换为c代码_bash 转换为C代码
bash 轉(zhuǎn)換為C代碼,并編譯為可執(zhí)行文件
[root@localhost ~]# wget http://www.datsi.fi.upm.es/~frosal/sources/shc-3.8.9.tgz
[root@localhost ~]# tar xvfz shc-3.8.9.tgz
[root@localhost ~]# cd shc-3.8.9
[root@localhost shc-3.8.9]# gcc -c shc.c
[root@localhost shc-3.8.9]# gcc -o shc shc.o
[root@localhost shc-3.8.9]# cp -a shc /bin/
[root@localhost ~]# shc -r -T -f wang.sh
[root@localhost ~]# gcc -c wang.sh.x.c
[root@localhost ~]# gcc -o wang wang.sh.x.o
將python代碼轉(zhuǎn)換為C代碼
[root@localhost ~]# yum install -y epel-release
[root@localhost ~]# yum install -y python-pip
[root@localhost ~]# yum install -y python-dev*
[root@localhost ~]# pip install cython
[root@localhost ~]# vim lyshark.py
[root@localhost ~]# cython lyshark.py --embed
[root@localhost ~]# gcc `python-config --cflags` `python-config --ldflags` lyshark.c -o lyshark
C語言調(diào)用shell命令,并返回結(jié)果
#include
int main()
{
FILE * fp;
char buffer[1024];
fp=popen("free -h |grep 'Mem:' |awk '{print $2}'","r");
fgets(buffer,sizeof(buffer),fp);
printf("%s",buffer);
pclose(fp);
return 0;
}
#include "stdafx.h"
#include
int _tmain(int argc, _TCHAR* argv[])
{
char psBuffer[128];
FILE *pPipe;
char * wang;
pPipe = _popen("dir", "rt");
fgets(psBuffer, 128, pPipe);
printf("%s",psBuffer);
feof(pPipe);
system("pause");
return 0;
}
總結(jié)
以上是生活随笔為你收集整理的python转换为c代码_bash 转换为C代码的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: ubuntu16.04下微信和TIM的安
- 下一篇: Java消息中间件
