📄 commfun.cpp
字号:
#include <netinet/in.h>#include <arpa/inet.h>#include <stdlib.h>#include <stdio.h>#include <string.h>#include <syslog.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <unistd.h>#include <termios.h>#include <sys/socket.h>#include <pthread.h>#include "mytypes.h"int savefile(char* filename,char* pdata,int ilen){ FILE* file=fopen(filename,"w+b"); fwrite(pdata,1,ilen,file); fclose(file);}int recvn(int sock,char* pbuff,int ilen){ //assert(sock>0&&pbuff&&ilen>0); int irevlen=0,i; char * ptemp=pbuff; while(irevlen<ilen) { if ((i=recv(sock,ptemp,1024,0))>0) { irevlen+=i; ptemp+=i; } else return -1; } return 1;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -