随笔分类 - C
摘要:#include #include #include int main() { FILE *fh = popen("ifconfig 2> /dev/null", "r"); char iwstation[4096] = {0}; char total[4096] ={0}; while(fgets(iwstation, 4096, fh)!=NULL){ strc...
阅读全文
摘要:int sock = socket(AF_INET, SOCK_STREAM, 0) //建立一个流式套接字,stream是流的意思,Tcp连接,提供序列化的、可靠的、双向连接的字节流。支持带外数据传输 先占个坑,以后再详细介绍其他参数
阅读全文
摘要:strcat: 将两个char类型连接。 char d[20]="GoldenGlobal"; char *s="View"; strcat(d,s); 结果放在d中 printf("%s",d); 输出 d 为 GoldenGlobalView (中间无空格) d和s所指内存区域不可以重叠且d必须
阅读全文
摘要:最近做的东西与socket十分紧密,所以很好奇它具体是如何实现的,以前也有了解过,但是又忘记了,于是把它记录下来,以便日后查看。 服务器端:server.c 客户端:client.c
阅读全文
摘要:参考http://www.cplusplus.com/doc/tutorial/structures/
阅读全文
摘要:1 #include 2 #include 3 4 int binsearch(int x,int v[],int n);//函数声明 5 6 int main() 7 { 8 int arr[]={1,2,3,4,5,6,7,8,9,10}; 9 int 结果,num;10...
阅读全文
摘要:1 #include 2 #include 3 //顺序查找基本思想:从线性表的一端开始,逐个检查关键字是否满足给定的条件 4 int SequentialSearch(int *a,int n,int x); 5 6 int main(void) 7 { 8 int m[10]={2,...
阅读全文
摘要:1 #include 2 #include 3 void BubbleSort(int *a,int n); 4 5 int main(void)//入口函数,整型,无参数 6 { 7 int k; 8 int a[10]={2,4,6,8,0,1,3,5,7,9}; 9 ...
阅读全文