This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub getTime | |
{ | |
my $time = shift || time(); | |
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time); | |
$year += 1900; | |
$mon ++; | |
$min = '0'.$min if length($min) < 2; | |
$sec = '0'.$sec if length($sec) < 2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#################################################################################### | |
# Description: Copy error files to another directory | |
# Usage: | |
# Creator: thinkhy | |
# Date: 2010.01.13 | |
#################################################################################### | |
use strict; | |
use warnings; | |
use Cwd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void WriteLog(CString strLog) | |
{ | |
EnterCriticalSection(g_cs); | |
static CString strFileName; | |
if (strFileName.IsEmpty()) | |
{ | |
strFileName.GetBuffer(MAX_PATH); | |
::GetModuleFileName(NULL, strFileName.GetBuffer(0), MAX_PATH); | |
::PathRemoveFileSpec(strFileName.GetBuffer(0)); | |
::PathAppend(strFileName.GetBuffer(0), L"Log.txt"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CMainFrame::DrawView(HBITMAP hbmp) | |
{ | |
ASSERT(hbmp != NULL); | |
CView *pView = GetActiveView(); | |
ASSERT(pView != NULL); | |
// pView->Invalidate(TRUE); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://topic.csdn.net/u/20080414/14/7e4737fe-53c5-443a-b38a-7735c423e4aa.html | |
对于send函数: | |
send函数只负责将数据提交给协议层。 | |
当调用该函数时,send先比较待发送数据的长度len和套接字s的发送缓冲区的长度,如果len大于s的发送缓冲区的长度,该函数返回SOCKET_ERROR; | |
如果len小于或者等于s的发送缓冲区的长度,那么send先检查协议是否正在发送s的发送缓冲中的数据; | |
如果是就等待协议把数据发送完,如果协议还没有开始发送s的发送缓冲中的数据或者s的发送缓冲中没有数据,那么send就比较s的发送缓冲区的剩余空间和len; | |
如果len大于剩余空间大小,send就一直等待协议把s的发送缓冲中的数据发送完,如果len小于剩余空间大小,send就仅仅把buf中的数据copy到剩余空间里(注意并不是send把s的发送缓冲中的数据传到连接的另一端的,而是协议传的,send仅仅是把buf中的数据copy到s的发送缓冲区的剩余空间里)。 | |
如果send函数copy数据成功,就返回实际copy的字节数,如果send在copy数据时出现错误,那么send就返回SOCKET_ERROR; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "apue.h" | |
ssize_t /* Read "n" bytes from a descriptor */ | |
readn(int fd, void *ptr, size_t n) | |
{ | |
size_t nleft; | |
ssize_t nread; | |
nleft = n; | |
while (nleft > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma comment(lib, "winmm.lib") | |
// call example | |
// 支持绝对路径和相对路径 | |
::PlaySound(strSoundFile.c_str(), NULL, SND_ASYNC|SND_NOWAIT|SND_FILENAME); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma comment(lib, "winmm.lib") | |
// call example | |
// 支持绝对路径和相对路径 | |
::PlaySound(strSoundFile.c_str(), NULL, SND_ASYNC|SND_NOWAIT|SND_FILENAME); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void SaveBitmap(HBITMAP hResult, wstring strBmpFile) | |
{ | |
BITMAP bmp = {0}; | |
GetObject(hResult, sizeof(BITMAP), &bmp); | |
BITMAPINFO bmpInfo = {0}; | |
bmpInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); | |
bmpInfo.bmiHeader.biWidth = bmp.bmWidth; | |
bmpInfo.bmiHeader.biHeight = bmp.bmHeight; | |
bmpInfo.bmiHeader.biPlanes = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#ifndef _AFX_NO_OCC_SUPPORT | |
#include "occimpl.h" | |
#endif | |
#pragma warning(disable:4706) | |
#define COMPILE_MULTIMON_STUBS | |
#include <multimon.h> | |
#pragma warning(default:4706) |
OlderNewer