很久以前的代码拿出来了!熟悉linux键盘驱动的这段代码太容易啦!
/*获取键盘的按值*/
#include
#include
#include
#include
#include
struct info
{
struct timeval time;
unsigned short type;
unsigned short code;
unsigned int value...
分类:
其他好文 时间:
2015-03-04 16:55:29
阅读次数:
236
char* pCh = "0xe6, 0x97, 0xa0, 0xe7, 0x95, 0x8c, 0xe6, 0xb5, 0x8f, 0xe8, 0xa7, 0x88";字符串的形式存在于内存中,达不到预期下面两种均可:unsigned char title[] = {0xe6, 0x97, 0xa...
分类:
其他好文 时间:
2015-03-04 16:26:40
阅读次数:
118
在交叉编译一个.cpp库时,出现如下错误:undefined reference to `__gxx_personality_sj0'undefined reference to `operator new[](unsigned int)'解决办法:修改库中的Makefile文件,在$(LD) 后面...
分类:
其他好文 时间:
2015-03-04 12:40:33
阅读次数:
458
#include
#include
#include
#include
#include
#include
#include
#include
#include
#pragma comment(linker, "/STACK:1024000000")
#define EPS (1e-8)
#define LL long long
#define ULL unsigned lon...
分类:
其他好文 时间:
2015-03-03 16:40:14
阅读次数:
120
熟练使用错误函数对开源库的正确使用特别重要。
下面先给出简单的应用实例:
包含头文件:openssl/err.h
//加载错误信息
ERR_load_ERR_strings();
ERR_load_crypto_strings();
// 获取错误号
unsigned long ulErr = ERR_get_error();
char szErrMsg[1024] = {0};
char *pTmp = NULL;
// 格式:error:errId:库:函数:原因
pTmp = ERR_er...
分类:
其他好文 时间:
2015-03-02 20:58:52
阅读次数:
183
//因为2^64次方不可能表示,直接定义unsigned __int64,可以自动截断。其他和POJ 2778差不多。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include ...
分类:
其他好文 时间:
2015-03-02 18:36:35
阅读次数:
191
首先介绍几个重要的数据结构。 1、pagetypedef struct page {
struct list_head list;
struct address_space *mapping;
unsigned long index;
struct page *next_hash;
atomic_t count;
unsigned long flags; /* atomic fl...
分类:
系统相关 时间:
2015-03-02 11:16:22
阅读次数:
249
1、memcpy 函数用于 把资源内存(src所指向的内存区域) 复制到目标内存(dest所指向的内存区域);拷贝多少个?有一个size变量控制拷贝的字节数;函数原型:void *memcpy(void *dest, void *src, unsigned int count);使用方法:(1)能够...
分类:
其他好文 时间:
2015-03-01 14:24:22
阅读次数:
147
由string类类型和vector类类型定义的类型,用以保存任意string对象或vector对象的长度,标准库类型将size_type定义为unsigned类型.
string::size_type它在不同的机器上,长度是可以不同的,并非固定的长度。但只要你使用了这个类型,就使得你的程序适合这个机器。与实际机器匹配。
string::size_type从本质上来说,是一个整型数。关键是由...
分类:
其他好文 时间:
2015-02-28 11:31:31
阅读次数:
162
1)、gd_t该数据结构保存了u-boot需要的配置信息:typedef struct global_data {bd_t *bd; //与板子相关的结构,见下面unsigned long flags;unsigned long baudrate; //波特率unsigned long...
分类:
其他好文 时间:
2015-02-27 20:12:37
阅读次数:
152