- 博客(9)
- 资源 (3)
- 收藏
- 关注
原创 strcpy函数实现
#include <stdio.h>char *strcpy(char *dst, const char *src){ char *res = dst; while ((*dst++ = *src++) != '\0') ; return res;}int main(void){ char src[] = "hello"; char dst[32] = {'...
2018-06-18 18:38:34
196
原创 strcmp函数实现
#include <stdio.h>#if 0#include <string.h>#elseint strcmp(const char *a, const char *b){ int i = 0; while (a[i] != '\0' && a[i] == b[i]) ++i; return a[i] - b[i];}#endif...
2018-06-18 18:37:09
576
原创 atoi函数实现
#include <stdio.h>#if 0#include <stdlib.h>#elseint atoi(const char *a){ int negative = 0; int sign = 0; int val = 0; while (*a != '\0') { if (*a == '+' || *a == '-') { if ...
2018-06-18 18:31:47
195
原创 qt在windows7系统实时显示网络利用率
// mainwindows.h#ifndef MAINWINDOW_H#define MAINWINDOW_H#include #include #include "windows.h"//#include "iphlpapi.h"//#include "netioapi.h"#define IF_MAX_STRING_SIZE 256#define IF_MAX_PHYS_ADDRESS_LE
2013-10-10 20:07:04
2163
转载 Warning::'XXX' will be initialized later
作为一个有强迫症的人,实在是受不了 warning 的存在这个warning是由于初始化顺序引起的, // 会出现warning 的代码!class cInit{public: cInit(std::string str,int a): str_(str), a_(a) { }private: int a_;
2012-04-14 14:43:47
813
转载 C中#if 0 和#if 1
当注释掉大块代码时,使用"#if 0"比使用"/**/"要好,因为用"/**/"做大段的注释要防止被注释掉的代码中有嵌套的"/**/",这会导致注释掉的代码区域不是你想要的范围, 当被注释掉的代码很大时容易出现这种情况,特别是过一段时间后又修改该处代码时更是如此。 在这里顺便对条件编译(#ifdef, #else, #endif, #if等)进行说明。以下分3种情况: 1. 情
2012-04-06 10:16:45
390
转载 简单内存泄漏检测方法 解决Detected memory leaks!
转自:点击打开链接最近在一个项目中,程序退出后都出现内存泄漏:Detected memory leaks!Dumping objects ->{98500} normal block at 0x05785AD0, 152 bytes long. Data: N x 7 > 3C AC 4E 10 00 00 00 00 BC A4 4E 10 78 B6 3
2012-03-29 13:59:34
439
原创 VC获取对话框指针
首先,获取对话框句柄:有两种方法:1、使用FindWindow()函数:HWND hDialog1 = ::FindWindow(NULL, _T("TestDialog"));//TestDialog为对话框的名字2、在CDialog1.cppHWND hDialog1;BOOL CDialog1::OnInitDialog(){ CDialog::OnInitDia
2012-03-16 22:21:34
985
原创 VC单选框设置
一、新建n个Radio Button;二、按ctrl+D给这些Radio Button排好顺序;三、将排在最前面的那个Radio Button的group属性设置为true;四、为Radio Button定义变量:int m_function;void CDialog1::DoDataExchange(CDataExchange* pDX){ CDialog::DoDataE
2012-03-16 11:27:11
940
基于Qt的图片浏览工具
2013-08-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人