[50c14b]: WFX.cpp Maximize Restore History

Download this file

WFX.cpp    54 lines (44 with data), 1.0 kB

 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
// WFX.cpp: implementation of the CWFX class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "chitem.h"
#include "WFX.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CWFX::CWFX()
{
}
CWFX::~CWFX()
{
}
int CWFX::WriteWFXToFile(int fhandle)
{
memcpy(header.filetype,"WFX V1.0",8);
if(write(fhandle,&header,sizeof(wfx_header) )!=sizeof(wfx_header) )
{
return -2;
}
m_changed=false;
return 0;
}
int CWFX::ReadWFXFromFile(int fhandle, long maxlen)
{
m_changed=false;
if(maxlen==-1) maxlen=filelength(fhandle);
if(maxlen!=sizeof(wfx_header) )
{
return -2;
}
if(read(fhandle,&header,sizeof(wfx_header) )!=sizeof(wfx_header) )
{
return -2;
}
return 0;
}