LINUX C 链表封装
main.c
//初始化队列
void InitQueue(LiQueue *q)
{
q=(LiQueue*)malloc(sizeof(LiQueue));
q->front=q->rear=NULL;
}
//判断是否为空
int QueueEmpty(LiQueue *q)
{
if(q->rear==NULL)
{
return 1;
}
else
{
return 0;
}
}
//释放
void ClearQueue(LiQueue *q)
{
QNode *p=q->front,*r;
if(p!=NULL)
{
r=p->next;
while(r!=NULL)
{
free(p);
p=r;
r=p->next;
}
}
free(q);
}
//实现队列的入队
void enQueue(LiQueue *q,struct TCPMASSAGE stTcpSendBuff)
{
//封装结点
QNode *s;
s=(QNode*)malloc(sizeof(QNode));
memcpy(&s->data , &stTcpSendBuff , sizeof(stTcpSendBuff));
//s->data =e;
s->next=NULL;
if(q->rear==NULL)
{
q->front =s;
q->rear =s;
}
else
{
q->rear->next =s;
q->rear =s;
}
}
//出队函数
int deQueue(LiQueue *q,struct TCPMASSAGE stTcpSendBuff)
{
QNode *t;
if(q->rear ==NULL)
{
return 0;
}
if(q->front ==q->rear )//只有一个结点
{
t=q->front;
q->front =NULL;
q->rear =NULL;
}
else
{
t=q->front;
q->front=q->front->next;
}
memcpy(stTcpSendBuff.cTcpBuff,t->data.cTcpBuff,t->data.len);
stTcpSendBuff.len = t->data.len;
free(t);
return 1;
}
/*
//出队函数
int deQueue(LiQueue *q,char *pstbuff,int *lenth)
{
QNode *t;
if(q->rear ==NULL)
{
return 0;
}
if(q->front ==q->rear )//只有一个结点
{
t=q->front;
q->front =NULL;
q->r
相关文档:
随着硬件不断的发展,未来的智能手机将越来越接近PC的性能,一个强大的手机操作系统将是挖掘不断飞跃的手机硬件性能的关键,只有强大的操作系统才能支持各种不断发展的手机应用,如Linux系统对java的完美支持以及优越的多进程调度,摩托罗拉很早就推出基于Linux系统的手机,随着Google的Android操作系统的推出,另一个基于L ......
The Linux USB input subsystem is a single, harmonized way to manage all input devices. This is a relatively new approach for Linux, with the system being partly incorporated in kernel version 2.4 and fully integrated in the 2.5 development series.
This article covers four basic areas: a descripti ......
一、下载安装程序
1、 下载内核源码(linux-2.6.33.tar.bz2),位置:https://www.kernel.org
2、 下载最新版的module-init-tools(module-init-tools-3.8.tar.bz2)和modutils(modutils-2.4.26-1.src.rpm)的源码
位置:http://www.kernel.org/pub/linux/kernel/people/rusty/modules/
位置:http://www. ......
先用who命令查看所有登陆终端
#who -uH
输出如下:
NAME LINE TIME IDLE PID COMMENT
root :0 2010-03-01 19:13 ? & ......
DBA:Linux
在 Linux x86 上安装 Oracle RAC 10g
作者:John Smiley
了解在 Red Hat Enterprise Linux 或 Novell SUSE Enterprise Linux 上从头安装 Oracle RAC 10g 的基础知识(仅用于评估)
目录
概述
背景
第 1 部分: 安装 Linux
第 2 部分: 为 Oracle 配置 Linux
第 3 部分: 准备共享磁盘
第 4 部分: ......