readdir()在多线程操作中不安全,Linux提供了readdir_r()实现多线程读取目录内容操作。#include
#include #include int main(void){ DIR* dirp; struct dirent
*dp1=malloc(sizeof(stru...
分类:
其他好文 时间:
2014-05-12 13:34:35
阅读次数:
914
偷西瓜
时间限制:1000 ms | 内存限制:65535 KB
难度:4
描述
对于农村的孩子来说最大的乐趣,莫过于和小伙伴们一块下地偷西瓜了,虽然孩子们条件不是很好,但是往往他们很聪明,他们总在计算着到达瓜田的距离,以及逃跑的路线,他们总是以最短的距离冲到瓜田里面,然后以最短的距离回到出发的地方,不过瓜田的大人们已经在他们来的路上等待他们。于是聪明的小伙伴们...
分类:
其他好文 时间:
2014-05-12 07:13:05
阅读次数:
383
typedef enum
//{
// GPIO_PIN_0 = ((u8)0x01), /*!
// GPIO_PIN_1 = ((u8)0x02), /*!
// GPIO_PIN_2 = ((u8)0x04), /*!
// GPIO_PIN_3 = ((u8)0x08), /*!
// GPIO_PIN_4 = ((u8)0x1...
分类:
其他好文 时间:
2014-05-11 07:10:01
阅读次数:
517
//链表操作:建立、插入、删除、查找、倒置、删除等基本操作
#include
#include
typedef
struct LNode
{
int data;
structLNode *next;
}LNode,*Llist;
LNode *creat_head();//创建一个空表
void creat_list(LNode *,int);//创...
分类:
其他好文 时间:
2014-05-11 03:33:11
阅读次数:
351
#include#includetypedef struct node { int data;
struct node *lchild,*rchild;};node * create()//先序建立二叉树,根左右{ int x=0; node *t;
printf(" input data:"); ...
分类:
其他好文 时间:
2014-05-11 01:19:08
阅读次数:
311
基于mysql数据库整合框架时出现的数据库字符编码的问题.
解决办法:数据库驱动的版本太高,换成低版本的,主要还是你的架包太不是最新版本,出现的兼容性问题。
分类:
编程语言 时间:
2014-05-10 18:13:53
阅读次数:
473
在下例中,演示了链表的各种操作
#include
using namespace std;
typedef struct Node
{
int data; //数据域
struct Node * next; //指针域
}NODE, *PNODE; //NODE相当于struct Node, PNODE相当于struct Node *
PNODE CreateList()...
分类:
其他好文 时间:
2014-05-10 04:29:49
阅读次数:
263
Redis的client设计如下:
/* With multiplexing we need to take per-clinet state.
* Clients are taken in a liked list. */
typedef struct redisClient {
int fd;
redisDb *db;
int dictid;
sds que...
分类:
其他好文 时间:
2014-05-10 03:44:21
阅读次数:
292
题目:意思就是判断给定的几条线段是否有相交的。
方法:模版吧,有空在来细细学习。
代码:
#include
#include
using namespace std;
struct Point
{
double x,y;
};
struct LineSeg
{
Point a,b;
};
double Cross(Point a, Point b, Poi...
分类:
其他好文 时间:
2014-05-10 03:39:07
阅读次数:
326
相关性质 可查看维基百科"二叉查找树"关键性质:设root为二叉查找树的结点
如果a是root的左结点 key[a] 2 #include 3 using namespace std; 4 /*二叉查找树*/ 5
/*实现中假设关键元素互不相同*/ 6 typedef i...
分类:
其他好文 时间:
2014-05-10 02:28:24
阅读次数:
630