
C++
jiht594
这个作者很懒,什么都没留下…
展开
-
extern "C"的作用
extern "C"的作用(一) 前些天,编程序是用到了很久以前写的C程序,想把里面的函数利用起来,连接发现出现了找不到具体函数的错误: 以下是假设旧的C程序库 C的头文件 /*-----------c.h--------------*/ #ifndef _C_H_ #define _C_H_ extern int add(int x, int转载 2012-05-17 15:41:52 · 921 阅读 · 0 评论 -
线程中添加消息循环
UINT ThreadFunc(LPVOID lpParam) //线程函数{ int bRet = 0; MSG msg; while(true) { if ((bRet = PeekMessage(&msg,NULL ,0,0,PM_REMOVE)) != 0)//Peek不阻塞,如果使用GetMessage会阻塞 { // han原创 2015-01-24 00:10:56 · 2980 阅读 · 0 评论 -
c/c++清空stdin缓冲区
C++清空1行cin.ignore( std::numeric_limits::max( ), '\n' );读完\n后, 函数结束清空所用cin.ignore( std::numeric_limits::max( ));//默认读完EOF后, 函数结束C清空1行while ( (c=getchar()) != '\n' && c != EOF ) {原创 2015-03-29 22:16:23 · 1434 阅读 · 0 评论 -
mingw with posix(支持std:thread)
mingw:http://sourceforge.net/projects/mingwbuilds/files/host-windows/releases/或者TDM-GCC:http://tdm-gcc.tdragon.net/download转载 2015-09-07 16:20:28 · 2453 阅读 · 0 评论 -
Modern C++ Design 第一章 Policy-Based Class Design
#include "stdafx.h"#include#includeusing namespace std;class RunBase{ virtual void go() = 0;};class Run100m : public RunBase{public: void go() { cout << "run 100 meters" << endl; }};原创 2016-08-20 20:37:32 · 569 阅读 · 0 评论