-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPacketDumper.cpp
More file actions
56 lines (45 loc) · 946 Bytes
/
PacketDumper.cpp
File metadata and controls
56 lines (45 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "stdafx.h"
#include "PacketDumper.h"
PacketDumper::PacketDumper()
{
}
PacketDumper::~PacketDumper()
{
}
void PacketDumper::setPath(CString path)
{
m_path = path;
}
CString PacketDumper::getPath()
{
return m_path;
}
//CString PacketDumper::getFileName()
//{
// return m_path.Sub;
//}
/**
* @brief Save the default dump file on m_path to path
* @param path save as path
* @return -
*/
void PacketDumper::dump(CString path)
{
CFile dumpFile(m_path, CFile::modeRead | CFile::shareDenyNone);
CFile saveAsFile(path, CFile::modeCreate | CFile::modeWrite);
copyFile(&saveAsFile, &dumpFile);
saveAsFile.Close();
dumpFile.Close();
}
/**
* @brief Copy the contents of the src file to the dest file
* @param dest Target file src piece
* @return -
*/
void PacketDumper::copyFile(CFile * dest, CFile * src)
{
char buf[1024];
int byteCount;
while ((byteCount = src->Read(buf, sizeof(buf))) > 0)
dest->Write(buf, byteCount);
}