最近在看nginx源码,看到定时器的时候,发现一个结构体利用偏移量求值问题,结构体相信做c开发的都遇到过,那么不知你对结构体中成员变量偏移这块是如何理解的;首先我们先看一下nginx中的那个让我迷惑的地方ev = (event_t*)((char*)node - offsetof(event_t,....
分类:
编程语言 时间:
2014-07-03 10:46:15
阅读次数:
234
1.区别wchar_t,char,WCHAR ANSI:即 char,可用字符串处理函数:strcat( ),strcpy( ), strlen( )等以str打头的函数。 UNICODE:wchar_t是Unicode字符的数据类型,它实际定义在里: typedef unsigned short ...
分类:
其他好文 时间:
2014-07-03 10:36:28
阅读次数:
230
清除输入行的空格,当时还想了一个来小时。。。 1 #include 2 3 int strlen(char *s) 4 { 5 int n; 6 7 for(n=0;*s++ !='\0';n++); 8 return n; 9 }10 main()11 {12 ...
分类:
其他好文 时间:
2014-07-03 09:39:16
阅读次数:
195
单词计算程序,为啥遍历输出的时候会出现段错误 1 #include 2 #include 3 #include 4 #include 5 6 #define MAXWORD 100 7 8 struct tnode{ 9 char *word; 10 int c...
分类:
其他好文 时间:
2014-07-03 09:26:20
阅读次数:
201
string类的构造函数:string(const char *s); //用c字符串s初始化string(int n,char c); //用n个字符c初始化此外,string类还支持默认构造函数和复制构造函数,如string s1;string s2="hello";都是正确的写法...
分类:
其他好文 时间:
2014-07-03 09:19:19
阅读次数:
170
Android:1、在CCImage中添加下面的方法://头文件声明略。cocos2d::CCSize CCImage::getStringSize(const char *text, const char * pFontName, int nSize){ JniMethodInfo minfo;....
分类:
其他好文 时间:
2014-07-03 09:18:41
阅读次数:
335
DbgPrint 输出1) 直接打印字符串。DbgPrint(“Hello World!”);2) 空结尾的字符串,你可以用普通得C语法表示字符串常量char variable_string[] = “Hello World”;DbgPrint(“%s”, variable_string);3) 空...
分类:
数据库 时间:
2014-07-03 07:16:16
阅读次数:
579
structDemo1# include # include enum EType{ One = 1,Tow,Three };struct S1{ int id ; char name [111]; long version ;};int main(void){ ET...
分类:
其他好文 时间:
2014-07-01 17:16:06
阅读次数:
151
题目大意:
问[s,e]之间有多少个 斐波那契数。
思路分析:
直接模拟高精度字符串的加法和大小的比较。
注意wa点再 s 可以从 0 开始
那么要在判断输入结束的时候注意一下。
#include
#include
#include
#include
using namespace std;
struct node
{
char str[111];
...
分类:
其他好文 时间:
2014-07-01 16:08:10
阅读次数:
243
题意:排序后字符串全排列
思路:好久没水一题了
#include
#include
#include
#include
using namespace std;
const int MAXN = 220;
char str[MAXN];
int main() {
while (scanf("%s", str) != EOF) {
int n = strlen(str);
...
分类:
其他好文 时间:
2014-07-01 15:09:17
阅读次数:
182