NoFear
随笔 - 48, 文章 - 0, 评论 - 6, 阅读 - 58938

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

12 2011 档案

摘要:View Code //有没有好的字符串匹配方法 把括号里的东西 取出来?#include <stdio.h>#include <stdlib.h>char s[]="uid=1000012(as) gid=1000000(domain users) groups=1000000(domain users),1000015(ABCD/users)";char *p,t[80];int n,r;int main() { p=s; while (1) { r=sscanf(p,"%*[^(](%79[^)])%n",t,&n) 阅读全文

posted @ 2011-12-27 14:32 Fear_Hao 阅读(160) 评论(0) 推荐(0) 编辑

摘要:View Code 一个由C/C++编译的程序占用的内存分为以下几个部分 1、栈区(stack)— 由编译器自动分配释放 ,存放函数的参数值,局部变量的值等。其操作方式类似于数据结构中的栈。 2、堆区(heap) — 一般由程序员分配释放, 若程序员不释放,程序结束时可能由OS回收 。注意它与数据结构中的堆是两回事,分配方式倒是类似于链表,呵呵。 3、全局区(静态区)(static)—,全局变量和静态变量的存储是放在一块的,初始化的全局变量和静态变量在一块区域, 未初始化的全局变量和未初始化的静态变量在相邻的另一块区域。 - 程序结束后有系统释放 4、文字常量区—常量字符串就是放在这里的。 程 阅读全文

posted @ 2011-12-23 11:42 Fear_Hao 阅读(499) 评论(0) 推荐(0) 编辑

摘要:View Code class Empty { public: Empty(); Empty(const Empty&); ~Empty(); Empty& operator=(const Empty& rhs); Empty* operator&(); const Empty* operator&() const; }; 让我不解的是网上为何流传上述的答案,而且我隐约记着在哪本本权威的书上看到这个说法的,最近偶然翻了一下侯捷翻译的中文简体《Effective c++, 2nd》 这本书终于找到了答案:条款45: 弄清C++在幕后为你所写、所调用的函数一 阅读全文

posted @ 2011-12-20 09:01 Fear_Hao 阅读(235) 评论(0) 推荐(0) 编辑

摘要:View Code int thread_num= mThreadnum-1; int i; int count=pwdvect.size(); int per = count / thread_num; int yu = count % thread_num; int x = 0, y = 0; for (i = 0; i != thread_num; i++) { if (i == 0) { x = 0; y = per - 1; } els... 阅读全文

posted @ 2011-12-19 09:31 Fear_Hao 阅读(137) 评论(0) 推荐(0) 编辑

摘要:View Code 一、字节序定义字节序,顾名思义字节的顺序,再多说两句就是大于一个字节类型的数据在内存中的存放顺序(一个字节的数据当然就无需谈顺序的问题了)。其实大部分人在实际的开发中都很少会直接和字节序打交道。唯有在跨平台以及网络程序中字节序才是一个应该被考虑的问题。在所有的介绍字节序的文章中都会提到字节序分为两类:Big-Endian和Little-Endian。引用标准的Big-Endian和Little-Endian的定义如下:a) Little-Endian就是低位字节排放在内存的低地址端,高位字节排放在内存的高地址端。b) Big-Endian就是高位字节排放在内存的低地址端,低 阅读全文

posted @ 2011-12-12 14:21 Fear_Hao 阅读(347) 评论(0) 推荐(0) 编辑

摘要:View Code int LoadDictionary(){ FILE *fp; fp=fopen("formatpwd.txt","rb"); fseek(fp,0,SEEK_END); size_t DicLength=ftell(fp); fseek(fp,0,SEEK_SET); char * pbuf = new char[DicLength+1]; memset(pbuf,0,DicLength); fread(pbuf,sizeof(char),DicLength,fp); PWD pwd; size_t offset... 阅读全文

posted @ 2011-12-08 11:07 Fear_Hao 阅读(184) 评论(0) 推荐(0) 编辑

摘要:View Code //in.txt://File Flag 2DPatch//1 3216//2 3216 (2548-3216 x 4)//3 3216 (2552-3216 x 4)//4 3212 (2556-3212 x 4)//5 3208 (2564-3216 x 4)//6 3204 (2572-3216 x 4)//7 3196 (2580-3216 x 4)//8 3192 (2588-3216 x 4)//9 3188 (2596-3216 x 4)//10 3184 (2548-3216 x 4)//11 3180 (2548-3216 x 4)//文档就是这样的格式, 阅读全文

posted @ 2011-12-06 14:11 Fear_Hao 阅读(197) 评论(0) 推荐(0) 编辑

摘要:View Code //************************************// 函数: HexToBin// 参数: const char * src// 参数: unsigned char * bin// 参数: int & len// 返回: void// 作用: 16进制 to 2进制//************************************void HexToBin(const char* src, unsigned char* bin, int &len){ //printf("... 阅读全文

posted @ 2011-12-06 11:52 Fear_Hao 阅读(346) 评论(0) 推荐(0) 编辑

摘要:View Code //************************************// 函数: BinToHex// 返回: void// 作用: 2进制文件转16进制文件//************************************void BinToHex(){ FILE *FpIn , *FpOut; int c ; FpIn=fopen("bin.txt","rb"); FpOut=fopen("Hex.txt","w"); if (NULL==FpIn) { printf(&q 阅读全文

posted @ 2011-12-06 11:02 Fear_Hao 阅读(395) 评论(0) 推荐(0) 编辑

摘要:View Code #include <stdio.h>#include <string>int main() { char list[] = "adfafa,sdfafaf,sdfsdfaf,sdfafaf,sdffafs"; char list2[10][20]={0}; char rule[] = ","; char *token; int tmplen=0; int offset=0; int num=0; token = strtok(list, rule); while (token!=NULL) { ... 阅读全文

posted @ 2011-12-05 16:40 Fear_Hao 阅读(466) 评论(0) 推荐(0) 编辑

摘要:View Code int max=100; //总数 int per = max/100; //每份 int flag=1; //1%标志 for(int i=0;i!=max;i++) { if(i/per >= flag) { flag++; if(flag%10==0) { ... 阅读全文

posted @ 2011-12-04 14:32 Fear_Hao 阅读(155) 评论(0) 推荐(0) 编辑

摘要:View Code //************************************// 函数: FindFileName// 返回: int// 作用: 所有当前目录匹配的文件名//************************************char * filename[20={0};int FindFileName(){ WIN32_FIND_DATA data; HANDLE hfind; char nameRule[6]={0}; char tempname[100]={0}; int i=0; ... 阅读全文

posted @ 2011-12-04 14:12 Fear_Hao 阅读(201) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示