Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

[dad864]: VVC.cpp Maximize Restore History

Download this file

VVC.cpp    72 lines (59 with data), 1.3 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// VVC.cpp: implementation of the CVVC class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "chitem.h"
#include "VVC.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CVVC::CVVC()
{
}
CVVC::~CVVC()
{
}
int CVVC::WriteVVCToFile(int fhandle)
{
memcpy(header.filetype,"VVC V1.0",8);
if(write(fhandle,&header,sizeof(vvc_header) )!=sizeof(vvc_header) )
{
return -2;
}
m_changed=false;
return 0;
}
int CVVC::ReadVVCFromFile(int fhandle, long maxlen)
{
m_changed=false;
if(maxlen==-1) maxlen=filelength(fhandle);
if(maxlen!=sizeof(vvc_header) )
{
return -2;
}
if(read(fhandle,&header,sizeof(vvc_header) )!=sizeof(vvc_header) )
{
return -2;
}
return 0;
}
CString CVVC::RetrieveResourceRef(int fh)
{
CString tmpstr;
int required;
if(fh<1) return "";
required=(BYTE *) &header.bam-(BYTE *) &header+8;
if(read(fh, &header, required)!=required)
{
close(fh);
return "";
}
close(fh);
RetrieveResref(tmpstr,header.bam);
return tmpstr;
}