- 博客(18)
- 收藏
- 关注
原创 queue
// Queue.cpp : 定义控制台应用程序的入口点。//// Queue.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include typedef struct { int size; //长度 int head; //头下标 int tail; //尾下标 int *first; /
2014-11-25 20:59:09 309
原创 栈
// Stack.cpp : 定义控制台应用程序的入口点。//stack 类似于:list 单链表#include "stdafx.h"#include struct stack{ int data; int size; struct stack *next;};stack *stack_init(){ stack *head; head = (stack*)mal
2014-11-24 20:40:38 301
原创 链表
// stu_list.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include #include #include #include typedef struct stu{ int num; int age; float score; char name[20+1]; struct stu *next;}student;
2014-11-16 20:41:33 368
原创 socket通信,无阻塞connect
直接代码 吧。。#include #include #include #include #include #include #include #include #include int main(int argc,char *argv[]){ if(argc <= 2) { printf("Usage:%s IP
2014-07-10 21:46:06 467
原创 I/O复用-epoll
sever.c#include #include #include #include #include #include #include #include #include #include #define MAX_EVENT_NUM 1024#define BUFF_SIZE 20//设置非阻塞int setnoblock
2014-07-10 21:12:35 297
原创 I/O利用-select
server.c#include #include #include #include #include #include #include int main(int argc,char *argv[]){ int sockfd = 0; int connfd = 0; if(argc <= 2) {
2014-07-09 21:46:57 346
原创 算法二:单向链表
#include#include#include#include#includetypedef struct lisklink{ int data; struct lisklink *next;}list;list *link1;//初始化链表void init_link(list **link){ //link->data = 0; //link->next
2014-05-22 20:35:43 307
原创 一:递归(正常递归与尾递归)
先上代码:#include#include//正常递归int fact(int n){ if(n<0) return 0; if(n == 0 || n == 1) return 1; else return n*fact(n-1);} //尾递归int factail(int n,int a){ if(n<0) return 0; if(n ==
2014-05-19 21:02:06 438
原创 LINUX下,编程自学十:基于UDP的广播
broadserver.c#include#include#include#include#include#include#include#include#includeint main(){ int socketfd; struct sockaddr_in server; char buf[1023]; //time_t tm; socketfd
2014-05-18 20:44:02 538
原创 LINUX下,编程自学九:daemon用于SERVER
#include#include#include#include#include#include#include#include#include#include#includevoid daemon_init(){ pid_t pid; //1.fork child process,if success exit parent process if((pid =
2014-05-08 21:19:50 390
原创 LINUX下,编程自学八:守护进程daemon
#include#include#include#include#include#includevoid main(int argc,char *argv[]){ pid_t pid; //1.fork child process,if success exit parent process pid = fork(); if(pid != 0) exit(0);
2014-05-08 20:55:24 442
原创 LINUX 下,编程自学七:gethostbyname
不多说:直接贴代码#include#include#include#include#include#include#include#include#include#includeint main(){ struct utsname hostname; struct hostent *hp; if(uname(&hostname) < 0) { perror
2014-05-07 21:05:13 322
原创 LINUX 下,编程自学六:TCP,多线程编写
threadserver.c#include#include#include#include#include#include#include#include#includestruct Arg{ int fd; struct sockaddr_in client;};void *function(void *arg);int main(){ int
2014-05-06 21:20:13 401
原创 LINUX 下,编程自学五:msg,mem,pipe通信
msg.c#include#include#include#include#include#include#includeint main(int argc,char *argv[]){ int shmsid; pid_t pid; key_t key; char *addr; //creat shm key = IPC_PRIVATE; shmsid =
2014-04-24 21:27:39 557
原创 LINUX 下,编程自学四:UDP通信(connect用于UDP)
service.c#include#include#include#include#include#include#include#include#define PORT 5678int main(){ int sock; struct sockaddr_in server; struct sockaddr_in client; size_t len; cha
2014-04-24 21:24:22 675
原创 LINUX下,编程自学三:多进程C/S
service#include#include#include#include#include#include#include#include#define PORT 1234#define LISTENNUM 20#define MAXSIZE 1000int main(){ int listenfd; int connfd; struct sockad
2014-04-24 21:17:03 349
原创 LINUX 下,编程自学一:单一C/S 通信
service.c#include#include#include#include#include#include#include#include#define PORT 10000#define BLACKLOG 5int main(int agrc,char *argv[]){ struct sockaddr_in server; struct sockadd
2014-04-24 21:13:53 353
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人