上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

2013年7月27日

将函数的二进制代码嵌入到程序中

摘要: #include /*int f(int *a, int *b){ return *a - *b;}*///函数f的二进制代码char f[]="\x55""\x89\xe5""\x8b\x4d\x08""\x8b\x45\x0c""\x8b\x10""\x8b\x01""\x29\xd0""\x5d""\xc3";typedef int(*FP)(int*,int*);int main(int argc, char 阅读全文

posted @ 2013-07-27 17:04 Sunny_NUAA 阅读(248) 评论(0) 推荐(0) 编辑

2013年7月21日

C程序实现快速从文件输入和输出到文件

摘要: #include int main(){ freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); float a,b=0; for (;scanf("%f",&a)!=EOF;) b+=a; printf("$%.2f\n", b/12); fprintf(stderr, "Over"); fclose(stdin); fclose(stdout); return 0;} 阅读全文

posted @ 2013-07-21 22:47 Sunny_NUAA 阅读(373) 评论(0) 推荐(1) 编辑

2013年7月18日

用内存映射读取大文件

摘要: void CTestDlg::OnBnClickedButton1(){ // TODO: 在此添加控件通知处理程序代码 SYSTEM_INFO sinf; GetSystemInfo(&sinf); HANDLE hFile = CreateFile(TEXT("E:\\WIN7.GHO"), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); HANDLE hFileMapping = CreateFileMapping(hFile, NUL. 阅读全文

posted @ 2013-07-18 15:51 Sunny_NUAA 阅读(423) 评论(0) 推荐(0) 编辑

2013年7月14日

获取环境变量

摘要: PTSTR pszValue = NULL;PCTSTR pszVariableName = TEXT("JAVA_HOME");// Get the size of the buffer that is required to store the valueDWORD dwResult = GetEnvironmentVariable(pszVariableName, pszValue, 0); if (dwResult != 0){// Allocate the buffer to store the environment variable value DWORD s 阅读全文

posted @ 2013-07-14 10:55 Sunny_NUAA 阅读(235) 评论(0) 推荐(0) 编辑

获取进程命令行参数

摘要: TRACE1("%s\n", GetCommandLineW());//获取命令行参数OutputDebugStringW(GetCommandLineW());int argNum;PWSTR *ppArgv = CommandLineToArgvW(GetCommandLineW(),&argNum);//将参数转成数组for (int i=0;i<argNum;i++){OutputDebugStringW(ppArgv[i]);}HeapFree(GetProcessHeap(),0,ppArgv);//ppArgv为系统内部分配的内存可以不释放,但在 阅读全文

posted @ 2013-07-14 10:31 Sunny_NUAA 阅读(573) 评论(0) 推荐(0) 编辑

2013年7月13日

UNREFERENCED_PARAMETER 的作用

摘要: #define UNREFERENCED_PARAMETER(P) (P) 换句话说 UNREFERENCED_PARAMETER 展开传递的参数或表达式。其目的是避免编译器关于未引用参数的警告。许多程序员,包括我在内,喜欢用最高级别的警告 Level 4(/W4)进行编译。Level 4 属于“能被安全忽略的事件”的范畴。虽然它们可能使你难堪,但很少破坏你的代码。例如,在你的程序中可能会有这样一些代码行:int x=1; 但你从没用到过 x。也许这一行是你以前使用 x 时留下来的,只删除了使用它的代码,而忘了删除这个变量。Warning Level 4 能找到这些小麻烦。所以,为什么... 阅读全文

posted @ 2013-07-13 22:44 Sunny_NUAA 阅读(345) 评论(0) 推荐(0) 编辑

获取进程路径

摘要: TCHAR szPath[MAX_PATH];GetModuleFileName( NULL/*m_hInstance*/, szPath, MAX_PATH ); 阅读全文

posted @ 2013-07-13 22:37 Sunny_NUAA 阅读(107) 评论(0) 推荐(0) 编辑

$err,hr

摘要: 在Visual C++ 中,可以在监视窗口添加 $err,hr 一行来实时现实错误。调试过程中,该项相当于在每次调用API函数之后调用GetLastError函数。其值由两部分组成,一个是错误代码(十六进制),另一个是错误代码所对应的文本提示。该方法支持多语言。 阅读全文

posted @ 2013-07-13 16:41 Sunny_NUAA 阅读(205) 评论(0) 推荐(0) 编辑

2013年7月12日

获取错误代码

摘要: DWORD dwError = GetLastError(); DWORD systemLocale = MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL); HLOCAL hlocal = NULL; // Buffer that gets the error message string BOOL fOk = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_ALLO... 阅读全文

posted @ 2013-07-12 18:38 Sunny_NUAA 阅读(448) 评论(0) 推荐(0) 编辑

2013年5月30日

http://www.cnblogs.com/wnarutou/archive/2012/11/19/2776576.html

摘要: http://www.cnblogs.com/wnarutou/archive/2012/11/19/2776576.html 阅读全文

posted @ 2013-05-30 14:16 Sunny_NUAA 阅读(152) 评论(0) 推荐(0) 编辑

上一页 1 ··· 4 5 6 7 8 9 10 11 下一页

导航