摘要: linux 下sqlite的 C编程之sqlite3_get_table说明:通过sqlite3_get_table查询得到的结果,其结构是:第一行是列名,随后的行才是值。遍历的方式和二维数组相同。#include <unistd.h>#include <stdio.h>#include <stdlib.h>#include <sqlite3.h>#include "test.h"int main(int argc, char **argv){ sqlite3 *db; char **dbResult; char *errms 阅读全文
posted @ 2011-09-03 14:38 火腿骑士 阅读(1114) 评论(0) 推荐(1) 编辑
摘要: 最近遇到了解析配置的问题,用正规表达式感觉大题小做,使用sscanf因只会用基本用法,感觉功能不够,上网搜了下,解析起来不费吹灰之力,代码也很简洁。原帖出处不详,网上到处是,我做了点修改名称:sscanf() - 从一个字符串中读进与指定格式相符的数据.函数原型:Int sscanf( string str, string fmt, mixed var1, mixed var2 ... );int scanf( const char *format [,argument]... );说明:sscanf与scanf类似,都是用于输入的,只是后者以屏幕(stdin)为输入源,前者以固定字符串为输入 阅读全文
posted @ 2011-09-03 09:21 火腿骑士 阅读(457) 评论(0) 推荐(0) 编辑
摘要: #define UPGRADE_DEBUG 1#ifdef UPGRADE_DEBUG#define stb_printf(...) printf (__VA_ARGS__)//#define stb_printf(...) #else#define stb_printf(...) do { } while (0)#endif/************************************************************************ 常量定义********************************************************** 阅读全文
posted @ 2011-09-02 15:25 火腿骑士 阅读(410) 评论(0) 推荐(0) 编辑
摘要: /*********头文件区****************************************************/#include "dare_program.h"//#include "dare_sntp.h"//#include "input_event.h"#include "ipanel_event.h"#include "stb_debug_ctrl.h"#ifdef STBSW_DEBUG_dare_program#define stb_printf(...) S 阅读全文
posted @ 2011-09-02 15:15 火腿骑士 阅读(332) 评论(0) 推荐(0) 编辑
摘要: http://www.cnblogs.com/livexy/archive/2010/07/06/1772213.htmlusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;using System.Data;using System.Data.Common;using System.Web.Script.Serialization;using System.IO;using System.Security.Cryptography;n 阅读全文
posted @ 2011-09-02 14:54 火腿骑士 阅读(270) 评论(0) 推荐(0) 编辑
摘要: IList<MediaInfo> l = new List<MediaInfo>(); l.OrderByDescending(m => m.Name);//降序 Dictionary<int, string> dList = new Dictionary<int, string>(); List<KeyValuePair<int, string>> list = dList.OrderByDescending(k => k.Value).ToList();//降序 阅读全文
posted @ 2011-09-02 14:50 火腿骑士 阅读(589) 评论(0) 推荐(0) 编辑
摘要: 1,防止一个头文件被重复包含 #ifndef COMDEF_H #define COMDEF_H //头文件内容 #endif 2,重新定义一些类型,防止由于各种平台和编译器的不同,而产生的类型字节数差异,方便移植。 typedef unsigned char boolean; /* Boolean type. */ typedef unsigned long int uint32; /* Unsigned 32 bit */ typedef unsigned short uint16; /* Unsigned 16 bit */ typedef unsigned char uint8; /* 阅读全文
posted @ 2011-09-02 13:49 火腿骑士 阅读(250) 评论(0) 推荐(1) 编辑
摘要: #include <stdio.h>//int* :整型指针类型 int* x: 整型指针类型的变量x int* y: 整型指针类型的变量y//int* swap():函数返回值类型为整数指针类型int* swap(int* x, int* y)//该行的*号皆表示为指针类型 注意书写方式 这样书写容易理解 {int temp;temp = *x;//函数体中出现的*号皆表示为指针间接访问符,单目运算符。*号后面紧跟指针变量,中间不允许有空格。 *x = *y;*y = temp;return y;//此y就是个已付值的指针变量。 }int main(int argc, char 阅读全文
posted @ 2011-08-31 14:11 火腿骑士 阅读(655) 评论(12) 推荐(2) 编辑
摘要: static pthread_mutex_t lock_mute;int modify_inode_for_chain(int index, char *content_id, int play_time){pthread_mutex_lock(&lock_mute);if(chain_list[index]->head == NULL || chain_list[index]->count == 0){pthread_mutex_unlock(&lock_mute);return 0;}node_gut* temp = chain_list[index]-> 阅读全文
posted @ 2011-08-30 15:42 火腿骑士 阅读(354) 评论(0) 推荐(0) 编辑
摘要: (1)指针的值是地址,指针是数组名是首地址;数组是指针特例,数组名是指针变量,是首地址。(2)函数形参是指针是时,则实参的值必须是地址,除了指针、数组直接传递变量名之外,其他类型须通过(&+类型变量名)取址方式传递;指针的指针存放的是指针,形参为指针的指针时传递的是(&+类型变量名)。(3)函数方法体及形参,及实参传递值给形参都在栈区进行,函数执行完毕,自动free栈区内存。 阅读全文
posted @ 2011-08-30 14:46 火腿骑士 阅读(469) 评论(4) 推荐(0) 编辑