forked from DediProgSW/SF100Linux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileIO.h
43 lines (27 loc) · 1.1 KB
/
FileIO.h
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
// file operation
// read file to buffer
// supported file format : bin,hex,s19,ram ...
#ifndef _ST_FILE_H
#define _ST_FILE_H
#include <vector>
#include <string>
using std::wstring;
class CFileIO
{
enum FILE_FORMAT{
BIN ,
HEX,
S19,
} ;
FILE_FORMAT GetFileFormatFromExt(const wstring& csPath) ;
bool ReadBINFile(const wstring& csPath, std::vector<unsigned char>& buffer) ;
bool ReadHEXFile(const wstring& csPath, std::vector<unsigned char>& buffer,unsigned char PaddingByte) ;
bool ReadS19File(const wstring& csPath, std::vector<unsigned char>& buffer,unsigned char PaddingByte) ;
bool WriteBINFile(const std::vector<unsigned char>& buffer, const wstring& csPath) ;
bool WriteHEXFile(const std::vector<unsigned char>& buffer, const wstring& csPath) ;
bool WriteS19File(const std::vector<unsigned char>& buffer, const wstring& csPath) ;
public :
bool Read(const wstring& csPath, std::vector<unsigned char>& buffer, unsigned char PaddingByte) ;
bool Write(const std::vector<unsigned char>& buffer,const wstring& csPath) ;
};
#endif //_ST_FILE_H