mydebug.cpp
资源名称:FireWall.rar [点击查看]
上传用户:apgaozhao
上传日期:2022-04-17
资源大小:69k
文件大小:1k
源码类别:
防火墙与安全工具
开发平台:
Visual C++
- #include "StdAfx.h"
- #include "mydebug.h"
- void msgbox_num(long num,const char *title)
- {
- char tempchar[20];
- ltoa(num,tempchar,10);
- MessageBox(NULL,tempchar,title,0);
- }
- //////////////////////////////////////////
- void file_num(long num,const char *path)
- {
- DWORD len;
- char tempchar[10];
- ltoa(num,tempchar,10);
- HANDLE hFile = CreateFile(path,GENERIC_WRITE,FILE_SHARE_READ, NULL,OPEN_ALWAYS,0,NULL);
- SetFilePointer(hFile ,0,0,FILE_END);
- WriteFile(hFile, (LPCVOID)tempchar,strlen(tempchar),&len,NULL);
- WriteFile(hFile, (LPCVOID)"rn",2,&len,NULL);
- CloseHandle(hFile);
- }
- ////////////////////////////////////////////
- void file_str(const char *str,const char *path)
- {
- DWORD len;
- HANDLE hFile = CreateFile(path,GENERIC_WRITE,FILE_SHARE_READ, NULL,OPEN_ALWAYS,0,NULL);
- SetFilePointer(hFile ,0,0,FILE_END);
- WriteFile(hFile, (LPCVOID)str,strlen(str)+1,&len,NULL);
- CloseHandle(hFile);
- }
- ////////////////////////////////////////////////
- void dbgprint_num(const char *title,DWORD num)
- {
- char *temp=new char[strlen(title)+15];
- sprintf(temp,"%s %d",title,num);
- OutputDebugString(temp);
- }
- void dbgprint_str(const char *title,const char *str)
- {
- int i=0;
- string temp;
- temp=str;
- temp.insert(0,title);
- i=temp.find("rn");
- while(i!=-1)
- {
- temp.replace(i,2,"rn");
- i=temp.find("rn",i+2);
- }
- OutputDebugString(temp.c_str());
- }