上一页 1 ··· 5 6 7 8 9
  2013年4月22日
摘要: mount -t cifs //ip/nfs /dst/ -o username=xxx,file_mode=0777,dir_mode=0777 阅读全文
posted @ 2013-04-22 12:41 宇睿 阅读(119) 评论(0) 推荐(0) 编辑
  2013年4月21日
摘要: 1 #include <unistd.h>2 int main(int argc, const char *argv[])3 {4 char* p[]={"udp-sender",NULL};5 if(execvp("/usr/local/sbin/udp-sender",p)<0)6 perror();7 return 0;8 } 阅读全文
posted @ 2013-04-21 22:52 宇睿 阅读(114) 评论(0) 推荐(0) 编辑
摘要: The rand() function returns a pseudo-random integer in the range 0 to RAND_MAX inclusive.(来自man手册)1 #include <stdio.h>2 #include <stdlib.h>3 #include <time.h>4 int main (void)5 {6 srand(time(NULL));7 printf("%d\n", 2*(rand () % 25000));8 return 0;9 } 阅读全文
posted @ 2013-04-21 16:10 宇睿 阅读(275) 评论(0) 推荐(0) 编辑
摘要: 先listen,然后获得端口 1 #include<unistd.h> 2 #include<stdio.h> 3 #include<unistd.h> 4 #include<string.h> 5 #include<signal.h> 6 #include <sys/stat.h> 7 #include <sys/types.h> 8 #include<fcntl.h> 9 #include <dlfcn.h>10 #include <errno.h>11 #include 阅读全文
posted @ 2013-04-21 15:33 宇睿 阅读(392) 评论(0) 推荐(0) 编辑
  2013年4月20日
摘要: 1 #include <string.h> 2 #include <pthread.h> 3 #include <semaphore.h> 4 #include <signal.h> 5 6 sem_t sem_meng; 7 8 void signalhandler ( int sig) 9 {10 sem_post(&sem_meng);11 printf("caught signal ok\n");12 } 13 14 int main(int argc, const char *argv[])15 {16 si 阅读全文
posted @ 2013-04-20 15:50 宇睿 阅读(172) 评论(0) 推荐(0) 编辑
摘要: 等待信号端 1 #include <signal.h> 2 #include <stdio.h> 3 4 void handle(int sig,siginfo_t* value,void*useless) 5 { 6 printf("%d\n",value->si_value.sival_int); 7 } 8 9 10 int main(int argc, const char *argv[])11 {12 struct sigaction act;13 sigemptyset(&act.sa_mask);14 act.sa_sig 阅读全文
posted @ 2013-04-20 15:40 宇睿 阅读(262) 评论(0) 推荐(0) 编辑
  2013年4月18日
摘要: 上完数据结构的课就没有自己写过快速排序,今天写了一个,风格非常有待提高。 1 #include <stdio.h> 2 void quickSort(int a[],int p, int q) 3 { 4 int i; 5 /*printf("%d %d\n",p,q); 6 for (i = 0; i < 12; i++) { 7 printf("%d ",a[i]);14 } 8 printf("\n");*/ 9 if(p+1==q)10 {11 if (a[p]>a[q]) {1... 阅读全文
posted @ 2013-04-18 14:13 宇睿 阅读(160) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9