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
#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
在C++中用到map时,如果KEY是自定义的struct,那么需要自己定义比较函数。因为只有基本类型有默认的比较方法。定义的方法有两种,一是在作为key的struct中,重载操作符less(
UrlMap; UrlKey stKey; stKey.dwBussID = 1; stKey.dwV...
分类:
编程语言 时间:
2014-05-10 06:10:26
阅读次数:
332
在下例中,演示了链表的各种操作
#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
#include
#include
#include
#ifndef VIRTUAL
#define VIRTUAL
#endif
#ifndef DELETE
#define DELETE(X) do { free(X);X = NULL; } while(0)
#endif
#define NEW(TYPE,pInstance,SUBTYPE) struct TYPE* pInst...
分类:
编程语言 时间:
2014-05-09 22:29:48
阅读次数:
455
BFS。 1 #include 2 #include 3 #include 4
#include 5 using namespace std; 6 7 #define INF 0x3fffffff 8 9 typedef struct
node_st {10 int x, y, ...
分类:
其他好文 时间:
2014-05-09 20:18:48
阅读次数:
339