”ningto.com“ 的搜索结果

     #ifndef SPEND_BLOCKQUEUE_H_ #define SPEND_BLOCKQUEUE_H_ #include #include #include #include "Def.h" // for DISALLOW_COPY_AND_ASSIGN template class BlockQueue ... DISALLOW_COPY_AND_ASSIGN(BlockQueu

     这个模型跟窗口有关,它使用消息来进行通知的。如下是对话框客户端关键代码,连接的是一个echo服务端。 首先,自定义一个消息WM_MYSOCKET,消息响应函数OnMySocketMessage,新建两个CListBox控件用来显示发送和接受...

     #ifndef USER2_BYTEBUFFER_H_ #define USER2_BYTEBUFFER_H_ #include #include #include #include typedef signed char int8; typedef unsigned char uint8;...typedef signed short int16;...typedef unsigned sh

     # 同时启动多个可执行程序,可以传入命令行参数。 import os import threading import random import time def start_process(): startcmd = r'a.exe uname=xxx;meeting=1;pwd=%s' % random.randint(100, 999999)...

     其中使用到的其他头文件地址: 线程:http://blog.csdn.net/tujiaw/article/details/8795014 阻塞队列:http://blog.csdn.net/tujiaw/article/details/8779466 消息:... #define DISALL

     template, size_t _Size> class array; class Package { public: template, size_t N> friend Package& operator(Package& pg, std::tr1::array, N> arr) { // ... } // ... }; 可以编译通过, 但是加入下面的使用, ...

     观察者模式(有时又被称为发布/订阅模式)是软件设计模式的一种。在此种模式中,一个目标对象管理所有相依于它的观察者对象,并且在它本身的状态改变时主动发出通知。这通常透过呼叫各观察者所提供的方法来实现。...

     int ConnectHasTimeout(SOCKET sock, const sockaddr *name, int namelen, int nsec) { int n; int error = 0; unsigned long flag = 1; ioctlsocket(sock, FIONBIO, (unsigned long*)&flag);...

     需要注意的是要将listenSock设置为非阻塞模式,这样在while(1)循环中accept才不会被阻塞。同时listenSock也要set到fdread中,如果不这样做的话,select只能监视到客户端的socket,当客户端没有进行任务IO操作的时候...

     #include #include #include #include #pragma comment(lib, "Ws2_32.lib") #pragma comment(lib, "IPHLPAPI.lib") std::string GetMaskFromIp(const std::string &ip) ... std::string ret;...

     For me, when I started freelancing full-time, it was (somewhat) the case of following others, more than anything else.What struck me most was the ease with which freelancers work, especially, if one c

     当有多个不同参数的回调函数需要管理时我们怎么办呢?它们并不能存放在同一个数组或者容器里面。 首先,我们可以定义一个抽象基类MyFunc,只有一个用来描述类型的成员变量type。 然后从基类中派生出一个模板类...

     Printer构造之后会在后台执行,每秒打印一次,主线程sleep 5秒后停止后台打印 #include #include #include #include #include class Printer { ... : timer_(io_, boost::posix_time::seconds(1)) ...

     std::wstring ansi2unicode(const std::string& ansi) { if (ansi.empty()) { return std::wstring(_T("")); } int len = MultiByteToWideChar(CP_ACP, 0, ansi.c_str(), -1, NULL, 0); wch

     #include #include #include #include #include #include #include #include #include #include #define LISTEN_PORT 5100 #define LISTEN_BACKLOG 32 ...void read_cb(struct bufferevent *bufferEvent,

     #include #include // 包含windows.h就不要包含这个头文件了 #pragma comment(lib, "Ws2_32.lib") struct int64tonet { union { __int64 w_; int r_[2]; }w, r; int64tonet(__int64 i) ... r.r_[0] = ht

     在我们调试比较复杂的程序的时候,尤其是多个dll,多线程的情况下debug有时候...下载地址:http://technet.microsoft.com/en-us/sysinternals/bb896647 只需要使用windows API OutputDebugString就可以了。 Sends

     #ifndef DYNALINK_H_ #define DYNALINK_H_ #include #include class DynaLink { public: DynaLink() : hDll_(NULL) { } DynaLink(const std::wstring &name) : hDll_(NULL) { ... vi

     将一个可执行应用程序作为一个服务,你的main函数就相当于此处的run,而这个run作为 回调函数的一部分被执行。作为服务的程序一般不会是执行一遍就退出的,即run函数是会被阻塞的。 如果你的run函数执行一次就退出...

STL笔记

标签:   iterator  vector  pair

     STL组件 1.打印容器内的所有元素 std::copy(vi1.begin(),vi1.end(), std::ostream_iterator(std::cout, ", ")); 2.sort排序 struct comp {  bool operator()(int x, int y) const // 由大到小 ... {

     #ifndef SPEND_THREAD_H_ #define SPEND_THREAD_H_ #include "Def.h" #include #include typedef std::tr1::function ThreadFunc; class Thread ... DISALLOW_COPY_AND_ASSIGN(Thread);... explicit Thread

     1. FTP下载文件 from ftplib import FTP print('start ...') f = FTP() f.connect('192.168.0.102', 21) f.login() d = f.dir() print(str(d)) fd = open('360wallpaper.jpg', 'wb') f.retrbinary('RETR 360...

     由于从控件上得到的数据是宽字符,所以分配空间的时候需要 注意的是单行数据长度要乘以2作为GlobalAlloc分配的大小 void Show::OnLbnDblclkListResult() { int curSel = m_listResult.GetCurSel();...

     读写XML文件: testConfigRead.xml 1234 first second third #include #include #include #include #include #include #include #include ...struct TestCo

     每隔一秒循环执行回调函数 #include #include struct cb_arg { struct event *ev; struct timeval tv; ...void timeout_cb(int fd, short event, void *params) ... struct cb_arg *arg = (struc

     自旋锁(spin lock)与互斥量(mutex)的比较 自旋锁是一种非阻塞锁,也就是说,如果某线程需要获取自旋锁,但该锁已经被其他线程占用时,该线程不会被挂起,而是在不断的消耗CPU的时间,不停的试图获取自旋锁。...

     zlib压缩解压 int Compress(const std::vector &input, std::vector &output) { unsigned long dstLen = input.size(); output.resize(dstLen); int iret = compress(&output[0], &dstLen, &input[0], input

10  
9  
8  
7  
6  
5  
4  
3  
2  
1