博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年12月6日

摘要: typedef struct { int a:2; int b:2; int c:1; }test; int main(){ test t; t.a = 1; t.b = 3; t.c = 1; printf("%d",t.a); printf("%d",t.b); printf("%d",t.c); }结果是1 -1 -1请问一下这是怎么算出来的?1 -1 -1还有就是根据CPU小端模式和大端模式,这几位是怎样放的?小端模式低 高1 1 1 1 0 0 0 0大端模式高 低0 ... 阅读全文

posted @ 2013-12-06 11:28 ccmfc 阅读(306) 评论(0) 推荐(0) 编辑

2012年8月6日

摘要: xp:#include <windows.h> #include <tlhelp32.h> int SearchProess(const char* name){ int ret=0; HANDLE handle=NULL; PROCESSENTRY32 pe32={0}; do { handle=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); if(handle==(HANDLE)-1)break; pe32.dwSize=sizeof(PROCESSENTRY32); if(!Process32First(handle 阅读全文

posted @ 2012-08-06 09:43 ccmfc 阅读(177) 评论(0) 推荐(0) 编辑

2012年6月13日

摘要: 函数原型HWND FindWindow(LPCSTR lpClassName,LPCSTR lpWindowName);参数列表: lpClassName 指向一个以null结尾的、用来指定类名的字符串或一个可以确定类名字符串的原子。如果这个参数是一个原子,那么它必须是一个在调用此函数前已经通过GlobalAddAtom函数创建好的全局原子。这个原子(一个16bit的值),必须被放置在lpClassName的低位字节中,lpClassName的高位字节置零。 如果该参数为null时,将会寻找任何与lpWindowName参数匹配的窗口。 lpWindowName 指向一个以null结尾... 阅读全文

posted @ 2012-06-13 14:13 ccmfc 阅读(659) 评论(0) 推荐(0) 编辑

2012年3月18日

摘要: #include <stdio.h>#include <winsock2.h>#include <time.h>#pragma comment(lib,"ws2_32.lib")char *plays[4]={ " | ", " / ", " - ", " \\ ",};char *host;int threadnum;int startport,endport,nowport;CRITICAL_SECTION for_w;struct timeval tim 阅读全文

posted @ 2012-03-18 19:23 ccmfc 阅读(258) 评论(0) 推荐(0) 编辑

2012年1月17日

摘要: #ifndef __JRY_SOCKET_H__#define __JRY_SOCKET_H__typedef enum { SUCCESS, FAIL, I_OPEN_FAIL, I_OPENURL_FAIL, I_READFILE_FAIL, H_QUERYINFO_FAIL,}ERRORFLAGS;int JRY_WSASTARUP();int jry_open_url(char * url, char ** buf, size_t * size);char* jry_get_localip(char *);#endif#include<windows.h>#include& 阅读全文

posted @ 2012-01-17 17:36 ccmfc 阅读(229) 评论(0) 推荐(0) 编辑

摘要: #include <stdio.h>#include <stdlib.h>#include <string.h>#include "j_socket.h"//typetypedef enum{ IP138, ITLEARNER }WEBTYPE;typedef struct __root_field__{ char city[64]; char provider[32];}root_location;typedef struct __ip138_field__{ root_location root;}ip138_field;typede 阅读全文

posted @ 2012-01-17 17:36 ccmfc 阅读(1190) 评论(0) 推荐(0) 编辑

摘要: #define是C语言中提供的宏定义命令,其主要目的是为程序员在编程时提供一定的方便,并能在一定程度上提高程序的运行效率,但学生在学习时往往不能 理解该命令的本质,总是在此处产生一些困惑,在编程时误用该命令,使得程序的运行与预期的目的不一致,或者在读别人写的程序时,把运行结果理解错误,这对 C语言的学习很不利。1 #define命令剖析1.1 #define的概念#define命令是C语言中的一个宏定义命令,它用来将一个标识符定义为一个字符串,该标识符被称为宏名,被定义的字符串称为替换文本。该命令有两种格式:一种是简单的宏定义,另一种是带参数的宏定义。(1) 简单的宏定义:#define &l 阅读全文

posted @ 2012-01-17 15:02 ccmfc 阅读(366) 评论(0) 推荐(0) 编辑

2011年12月23日

摘要: #include <stdlib.h>#include <stdio.h>#include <string.h>#define MAX_PATH 256int strch_index_r(const char *str, const char ch){ char *tmp=(char*)str+strlen(str)-1;while(tmp!=str && *tmp!=ch && tmp--);return tmp-str;}int data_file_size(const char *path){ int ret=0; FI 阅读全文

posted @ 2011-12-23 16:07 ccmfc 阅读(1132) 评论(0) 推荐(0) 编辑

2011年12月7日

摘要: char* ip_long2str(const unsigned long ip, char *pDest){ unsigned char pTmp[4]={0};*(unsigned int*)pTmp=ip; sprintf(pDest, "%d.%d.%d.%d", *(pTmp+0),*(pTmp+1),*(pTmp+2),*(pTmp+3));return pDest;}int ATOI(const char *pSrc, const int size, unsigned char *iDest){ int i=0;while(*(pSrc+i) &&am 阅读全文

posted @ 2011-12-07 17:57 ccmfc 阅读(609) 评论(0) 推荐(0) 编辑

摘要: #include <iostream>using namespace std;#define MAX_MUL_SIZE 256#define MUL_SPRINTF 1#define MUL_FRINED 1#define DELETE(p) \{\ if(p)\{\ delete(p);\ p=NULL;\}\}#define NEW_SET(p,ch,size) \{\ p=new char[size];\ memset(p, ch, size);\}#define CLS_STRCH(p) \{\ if(back_strch(p, '.'))\{\ cls_b 阅读全文

posted @ 2011-12-07 15:56 ccmfc 阅读(640) 评论(0) 推荐(0) 编辑