📄 datacompression.cpp
字号:
// DataCompression.cpp : Define virtual class for Coder and Decoder
//
// Author: Shen Hongwei
// Date: Sep.28, 2005
// Location: Beijing, China
//
#include "StdAfx.h"
#include "./DataCompression.h"
CompressionHeader::CompressionHeader(void)
{
}
CompressionHeader::~CompressionHeader(void)
{
}
void CompressionHeader::Init(fstream * p_fs)
{
this->fs = p_fs;
}
bool CompressionHeader::ReadHeader(void)
{
union u {
unsigned long l;
char str[4]; // NT_REVISISTED
} un;
this->fs->read(un.str, 4);
if (this->fs->eof()) {
this->length = 0;
return false;
} else {
this->length = un.l;
}
this->fs->read(un.str, 4);
if (this->fs->eof()) {
this->origin_len = 0;
return false;
} else {
this->origin_len = un.l;
return true;
}
}
bool CompressionHeader::WriteHeader(void)
{
this->fs->seekp(0);
union u {
unsigned long l;
char str[4]; // NT_REVISISTED
} un;
un.l = this->length;
this->fs->write(un.str, 4);
un.l = this->origin_len;
this->fs->write(un.str, 4);
return true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -