摘要:
mount -t cifs //ip/nfs /dst/ -o username=xxx,file_mode=0777,dir_mode=0777 阅读全文
摘要:
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 } 阅读全文
摘要:
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 } 阅读全文
摘要:
先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 阅读全文
摘要:
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 阅读全文
摘要:
等待信号端 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 阅读全文
摘要:
上完数据结构的课就没有自己写过快速排序,今天写了一个,风格非常有待提高。 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... 阅读全文