本文整理汇总了C++中ReadHeader函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadHeader函数的具体用法?C++ ReadHeader怎么用?C++ ReadHeader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadHeader函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: free
BMMRES
BitmapIO_EPS::GetImageInfoDlg (HWND hWnd, BitmapInfo *info,
const TCHAR *filename)
{
free (iFilename);
iFilename = NULL;
if (filename) {
iFilename = (TCHAR *) malloc ((_tcslen(filename)+1)*sizeof(TCHAR));
if (iFilename)
_tcscpy (iFilename, filename);
ReadHeader (iFilename);
} else if (info->Name ()) {
iFilename = (TCHAR *)
malloc ((_tcslen(info->Name ())+1)*sizeof(TCHAR));
if (iFilename)
_tcscpy (iFilename, info->Name ());
ReadHeader (iFilename);
} else {
MessageBox (hWnd, _T("EPS GetImageInfoDlg called with no file name"),
_T("EPS Plugin"), MB_ICONINFORMATION);
return BMMRES_FILENOTFOUND;
}
DialogBoxParam (hResource,
MAKEINTRESOURCE (IDD_INFO_DIALOG),
hWnd,
ImageInfoDlg,
(LPARAM) this);
return BMMRES_SUCCESS;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:32,代码来源:eps.cpp
示例2: ksiazek
static PSBOOK *ReadAllOldAtoms(char *bok_filename,int *NumOfWav)
{ /* Wczytanie wszystkich zestawow ksiazek (usredniona mapa Wignera) */
extern unsigned long NumberOfAllWaveForms;
int i,k,NumberOfBloks,j,num_of_wav;
PSBOOK *book=NULL;
FILE *plik=NULL;
HEADER head; /* Funkcja zwraca globalna liczbe atomow */
ATOM atom;
float df;
if((NumberOfBloks=LicznikKsiazek(bok_filename))==-1)
ERROR("Problemy z odczytem struktury ksiazki !");
num_of_wav=(int)NumberOfAllWaveForms;
if((book=(PSBOOK *)malloc((unsigned)num_of_wav*sizeof(PSBOOK)))==NULL)
ERROR("Brak pamieci (ReadAllAtoms) !");
if((plik=fopen(bok_filename,"rb"))==NULL)
ERROR("Problemy przy otwarciu zbioru !\n");
if(ReadHeader(&head,plik)==-1)
ERROR("Blad czytania naglowka (ReadAllAtoms) !");
fseek(plik,0L,SEEK_SET);
df=2.0F*M_PI/(float)(head.signal_size);
Ec=E0=0.0F;
for(i=0,k=0 ; i<NumberOfBloks ; i++)
{
if(ReadHeader(&head,plik)==-1)
ERROR("Blad czytania naglowka (ReadAllAtoms) !");
if(head.signal_size!=DimBase) /* W przypadku niezgodnosci */
if(prn==ON)
fprintf(stderr,"UWAGA ! Niezgodnosc rozmiaru bazy (%d)"
" i analizowanego naglowka (%d)\n",
DimBase,head.signal_size);
E0+=head.signal_energy;
for(j=0 ; j<head.book_size ; j++)
{
if(ReadAtom(&atom,plik)==-1)
ERROR("Blad czytania atomu (ReadAllAtoms) !");
book[k].s=(float)(1<<(atom.octave));
book[k].t=(float)atom.position;
book[k].w=atom.modulus;
book[k].f=df*(float)atom.frequency;
book[k].amplitude=atom.amplitude;
Ec+=SQR(atom.modulus);
k++;
}
}
fclose(plik);
*NumOfWav=num_of_wav;
return book;
}
开发者ID:dellagustin,项目名称:mp31,代码行数:57,代码来源:wig2gif.c
示例3: ReadSkinnedAnimationFromFile
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
void CSAnimProvider::ReadSkinnedAnimationFromFile(StorageLocation in_location, const std::string& in_filePath, const ResourceProvider::AsyncLoadDelegate& in_delegate, const SkinnedAnimationSPtr& out_resource) const
{
IBinaryInputStreamUPtr stream = Application::Get()->GetFileSystem()->CreateBinaryInputStream(in_location, in_filePath);
u32 numFrames = 0;
s32 numSkeletonNodes = 0;
if(ReadHeader(stream, in_filePath, out_resource, numFrames, numSkeletonNodes) == false)
{
CS_LOG_ERROR("Failed to read header in anim: " + in_filePath);
out_resource->SetLoadState(Resource::LoadState::k_failed);
if(in_delegate != nullptr)
{
Application::Get()->GetTaskScheduler()->ScheduleTask(TaskType::k_mainThread, [=](const TaskContext&) noexcept
{
in_delegate(out_resource);
});
}
return;
}
ReadAnimationData(stream, numFrames, numSkeletonNodes, out_resource);
out_resource->SetLoadState(Resource::LoadState::k_loaded);
if(in_delegate != nullptr)
{
Application::Get()->GetTaskScheduler()->ScheduleTask(TaskType::k_mainThread, [=](const TaskContext&) noexcept
{
in_delegate(out_resource);
});
}
}
开发者ID:AzCopey,项目名称:ChilliSource,代码行数:34,代码来源:CSAnimProvider.cpp
示例4: ReadHeader
// Parses the entire contents of an XNB file.
void ContentReader::ReadXnb()
{
// Read the XNB header.
uint32_t endPosition = ReadHeader();
ReadTypeManifest();
uint32_t sharedResourceCount = Read7BitEncodedInt();
// Read the primary asset data.
Log.WriteLine("Asset:");
ReadObject();
// Read any shared resource instances.
for (uint32_t i = 0 ; i < sharedResourceCount; i++)
{
Log.WriteLine("Shared resource %d:", i);
ReadObject();
}
// Make sure we read the amount of data that the file header said we should.
if (FilePosition() != endPosition)
{
throw app_exception("End position does not match XNB header: unexpected amount of data was read.");
}
}
开发者ID:jlyonsmith,项目名称:ParseXnb,代码行数:29,代码来源:ContentReader.cpp
示例5: Decompress
void Decompress(char* source, char* dest) {
assert(source != nullptr);
assert(dest != nullptr);
BinaryReader reader(source);
BinaryWriter writer(dest);
ReadHeader(reader);
maxDictSize_ = 1 << indexBits_;
AllocateDictionary();
TrieNode* previousNode = nullptr;
unsigned char firstChar;
unsigned char lastChar;
while(reader.IsEOF() == false) {
int index = reader.ReadBits(IndexBits());
if(index == maxDictSize_ -1) break;
if(index >= dictSize_) {
firstChar = WriteString(previousNode, writer);
writer.WriteByte(lastChar);
}
else {
firstChar = WriteString(nodes_[index], writer);
}
if(previousNode) {
InsertValue(firstChar, previousNode);
}
lastChar = firstChar;
previousNode = nodes_[index];
}
}
开发者ID:Nuos,项目名称:CompressionAlgorithms,代码行数:35,代码来源:LZW.hpp
示例6: Drawable
Mesh::Mesh(Program &program, const char *filename)
: Drawable(program)
, vbuffer(-1)
, nbuffer(-1)
, tbuffer(-1)
, fbuffer(-1)
, texture(NULL)
{
FILE *fp = fopen(filename, "r");
if(!fp)
{
std::cout << "Could not open file: " << filename << " :" << strerror(errno) << std::endl;
exit(-1);
}
int num_vertices, num_faces;
bool have_normals = false;
bool have_tex = false;
//Read the header
ReadHeader(fp, num_vertices, num_faces, have_normals, have_tex);
ReadVertexData(fp, num_vertices, have_normals, have_tex);
ReadFaceData(fp, num_faces);
InitBuffers();
}
开发者ID:Wynjones1,项目名称:game,代码行数:25,代码来源:drawable.cpp
示例7: Decompress
void Decompress(char* source, char* dest) {
BinaryReader reader(source);
ReadHeader(reader);
BinaryWriter writer(dest);
SlidingWindow window(nullptr, bufferSize_, MaxOffset(), MaxLength() - 1);
window.Initialize();
while(reader.IsEOF() == false) {
int length = reader.ReadBits(lengthBits_);
int value;
if(length == MaxLength()) {
break;
}
if(length == 0) {
value = reader.ReadByte();
}
else {
int offset = reader.ReadBits(offsetBits_);
value = reader.ReadByte();
for(int i = 0; i < length; i++) {
int temp = window.CurrentByte(-offset - 1);
writer.WriteByte(temp);
window.WriteByte(temp);
window.AdvanceWindow(1);
}
}
writer.WriteByte(value);
window.WriteByte(value);
window.AdvanceWindow(1);
}
}
开发者ID:gratianlup,项目名称:CompressionAlgorithms,代码行数:35,代码来源:LZ77.hpp
示例8: ReadHeader
u64 Movie::GetMovieProgramID(const std::string& movie_file) const {
auto header = ReadHeader(movie_file);
if (header == boost::none)
return 0;
return static_cast<u64>(header.value().program_id);
}
开发者ID:lioncash,项目名称:citra,代码行数:7,代码来源:movie.cpp
示例9: ReadHeader
/* Moves the cursor past the chunk header, which is six bytes. */
void t3DSParser::EnterChunk()
{
if(m_xFile == 0 || !m_xFile->isOpen())
return;
ReadHeader();
}
开发者ID:dulton,项目名称:53_hero,代码行数:8,代码来源:3DSParser.cpp
示例10: log_trace
bool Client::GetPostResult(Value& result)
{
log_trace();
gettimeofday( &startTime_, 0 );
result.SetInvalid();
if (responseProcessed_)
{
PreserveReceiveBuffer();
ResetTransaction();
}
if (socket_.IsConnected(0) &&
ReadHeader(result) &&
ReadResponse(result))
{
switch (ProcessResponse(result))
{
case ProcessResponseSuccess : return true;
case ProcessResponseErrorKeepOpen : return false;
}
}
Reset();
return false;
}
开发者ID:AlbrechtL,项目名称:anyrpc,代码行数:26,代码来源:client.cpp
示例11: ReadSectionLocators
int CADFile::ParseFile( enum OpenOptions eOptions, bool bReadUnsupportedGeometries )
{
if( nullptr == pFileIO )
return CADErrorCodes::FILE_OPEN_FAILED;
if( !pFileIO->IsOpened() )
{
if( !pFileIO->Open( CADFileIO::read | CADFileIO::binary ) )
return CADErrorCodes::FILE_OPEN_FAILED;
}
// Set flag which will tell CADLayer to skip/not skip unsupported geoms
bReadingUnsupportedGeometries = bReadUnsupportedGeometries;
int nResultCode;
nResultCode = ReadSectionLocators();
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = ReadHeader( eOptions );
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = ReadClasses( eOptions );
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = CreateFileMap();
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
nResultCode = ReadTables( eOptions );
if( nResultCode != CADErrorCodes::SUCCESS )
return nResultCode;
return CADErrorCodes::SUCCESS;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:33,代码来源:cadfile.cpp
示例12: ReadData
/*********************************************************************
*
* ReceiveBytes()
*
********************************************************************/
int CConsolePort::ReceiveBytes( char* aBuff, int *aSize)
{
int ret = 0;
// If we are just the data part of the frame iReadingFlag is true
if( iReadingData == 1 )
{
ret = ReadData( aBuff, aSize );
if ( ret != 0 )
return -1;
}
else
{
// Else we are reading the header - so get the next command
ret = ReadHeader( aBuff, aSize );
if ( ret != 0 )
return -1;
// Set the flag to true now that we have read the header,
// so that the data part is read in the next iteration.
iReadingData = 1;
}
// Return
return ret;
}
开发者ID:fedor4ever,项目名称:testexec,代码行数:32,代码来源:CConsolePort.cpp
示例13: _Read
bool RINEX_NavigationMessage::_Read(std::ifstream &ifs)
{
std::string buf;
if (ifs == 0)
{
return false;
}
else
{
// Do nothing
}
if (false == ReadHeader(ifs, leapSecond))
{
return false;
}
else
{
// Do nothing
}
if (false == ReadBody(ifs, leapSecond))
{
return false;
}
else
{
// Do nothing
}
return true;
}
开发者ID:bunbun042000,项目名称:RINEXanalyzer,代码行数:33,代码来源:RINEX_NavigationMessage.cpp
示例14: Open
static int Open(void *context, SYS_FILEHANDLE file, V3XA_HANDLE *info)
{
OGG_context *ctx = (OGG_context*)context;
ReadHeader(ctx, file);
if (info)
{
int playLength, fileSize;
info->samplingRate = ctx->vi.rate;
#ifdef SUPPORT_IEEE_AUDIO
info->sampleFormat = V3XA_FMTIEEE;
#else
info->sampleFormat = V3XA_FMT16BIT;
#endif
if (ctx->vi.channels >= 2)
info->sampleFormat|= V3XA_FMTSTEREO;
fileSize = FIO_cur->fsize(file);
playLength = (fileSize * 8) / ctx->vi.bitrate_nominal;
info->length = playLength * ctx->vi.rate << 1;
info->loopend = 0;
info->loopstart = 0;
info->codec = &V3XA_Codec_OGG;
}
return 1;
}
开发者ID:cbxbiker61,项目名称:nogravity,代码行数:25,代码来源:iss_ogg.c
示例15: switch
void CLoader7Z::ReadBloc(const std::streampos offset, const std::size_t size)
{
#ifdef T_DEBUG
CApplication::getApp()->log(CString("Lecture de %1 octets depuis l'offset %2").arg(size).arg(offset), ILogger::Debug);
#endif
if (size == 0)
return;
char * header = new char[size];
m_file.seekg(offset, std::ios_base::beg);
m_file.read(header, size);
try
{
switch (header[0])
{
case kHeader:
ReadHeader(header);
break;
case kEncodedHeader:
ReadEncodedHeader(header);
break;
}
}
catch (...)
{
//...
}
delete[] header;
return;
}
开发者ID:teddy-michel,项目名称:TEngine,代码行数:35,代码来源:CLoader7Z.cpp
示例16: ReadHeader
void LvlArchive::Load()
{
// Read and validate the header
LvlHeader header;
ReadHeader(header);
if (header.iNull1 != 0 || header.iNull2 != 0 || header.iMagic != MakeType('I', 'n', 'd', 'x'))
{
LOG_ERROR("Invalid LVL header");
throw InvalidLvl("Invalid header");
}
// Read the file records
std::vector<FileRecord> recs;
recs.reserve(header.iNumFiles);
for (auto i = 0u; i < header.iNumFiles; i++)
{
FileRecord rec;
mStream.ReadBytes(&rec.iFileNameBytes[0], sizeof(rec.iFileNameBytes));
mStream.ReadUInt32(rec.iStartSector);
mStream.ReadUInt32(rec.iNumSectors);
mStream.ReadUInt32(rec.iFileSize);
recs.emplace_back(rec);
}
for (const auto& rec : recs)
{
mFiles.emplace_back(std::make_unique<File>(mStream, rec));
}
LOG_INFO("Loaded LVL '" << mStream.Name() << "' with " << header.iNumFiles << " files");
}
开发者ID:crafn,项目名称:alive,代码行数:31,代码来源:lvlarchive.cpp
示例17: OpenIn
FieldList
OpenIn(char *filename, /* name of input file */
char **version, /* version (output) */
int *arch, /* architecture (output) */
long *pre_size, /* preamble size (output) */
long *hdr_size, /* header size (output) */
long *rec_size, /* record size (output) */
FILE **file) /* input file (output) */
{
FILE *input;
if (filename == NULL)
return NULL;
if (strcmp(filename, "-") == 0)
input = stdin;
else
input = fopen(filename, "r");
if (input == NULL)
return NULL;
if (file != NULL)
*file = input;
return ReadHeader(version, arch, pre_size, hdr_size, rec_size, input);
}
开发者ID:RobBullen,项目名称:AudioMorphing,代码行数:27,代码来源:esignal.c
示例18: PlayMovie
int PlayMovie(const char *filename) {
char* str=malloc(1024);
if(Movie.Status == Recording)
StopMovie();
if ((Movie.fp = fopen(filename, "r+b")) == NULL)
{
free(str);
return -1;
}
strcpy(str, filename);
Movie.filename=str;
PlaybackFileOpened=1;
framecounter=0;
Movie.ReadOnly = 1;
Movie.Status=Playback;
Movie.Size = MovieGetSize(Movie.fp);
strcpy(MovieStatus, "Playback Started");
ReadHeader(Movie.fp);
YabauseReset();
return 0;
}
开发者ID:paul-met,项目名称:yabause,代码行数:26,代码来源:movie.c
示例19: VReadObjectData
/*
** read several rows of data from a file
*/
void
VReadObjectData (FILE *fp,int object_id,VImage *image)
{
static VImageInfo imageInfo;
static VAttrList list=NULL;
fseek(fp,0L,SEEK_SET);
if (! ReadHeader (fp)) VError("error reading header");
if (! (list = ReadAttrList (fp)))
VError("error reading attr list");
if (! VGetImageInfo(fp,list,object_id,&imageInfo))
VError(" error reading image info");
if (imageInfo.nbands != VImageNBands((*image)))
VError("incorrect number of bands");
if (imageInfo.nrows != VImageNRows((*image)))
VError("incorrect number of rows");
if (imageInfo.ncolumns != VImageNColumns((*image)))
VError("incorrect number of columns");
if (imageInfo.repn != VPixelRepn((*image)))
VError("incorrect pixel representation");
if (! VReadBlockData (fp,&imageInfo,0,imageInfo.nrows,image))
VError(" error reading data");
}
开发者ID:Margulis,项目名称:via,代码行数:31,代码来源:BlockFileIO_2.c
示例20: while
bool
Xfer::ReadPendingMessages()
{
// While there are complete messages, read them.
while(ReadHeader())
{
if (opcode > nextSpecialOpcode && opcode < 0)
{
if (opcode == -1)
bufferedInput.Flush();
// If the callback and the data were provided, call the callback
// so it can process the user-defined opcode.
if(specialOpcodeCallback != 0)
specialOpcodeCallback(opcode, specialOpcodeCallbackData);
if (opcode == -1)
return true;
continue;
}
bufferedInput.WriteInt(opcode);
bufferedInput.WriteInt(length);
for (int i=0; i<length; i++)
{
unsigned char tmp;
input->Read(&tmp);
bufferedInput.Write(tmp);
}
}
return false;
}
开发者ID:EricAlex,项目名称:ThirdParty-dev,代码行数:34,代码来源:Xfer.C
注:本文中的ReadHeader函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论