当前位置: 首页>>代码示例>>C++>>正文


C++ TFileStream::ReadBuffer方法代码示例

本文整理汇总了C++中TFileStream::ReadBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ TFileStream::ReadBuffer方法的具体用法?C++ TFileStream::ReadBuffer怎么用?C++ TFileStream::ReadBuffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TFileStream的用法示例。


在下文中一共展示了TFileStream::ReadBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TFileStream

BOOL	TStripInfo::OpenInfo(CONST TCHAR* szFilePath)
{
    TFileStream* outStream = new TFileStream(szFilePath, fmOpenRead);

   	outStream->ReadBuffer(&_stripVisual->fPRSMarkX, sizeof(INT32));
    outStream->ReadBuffer(&_stripVisual->fPRSMarkY, sizeof(INT32));
    outStream->ReadBuffer(&_stripVisual->fDeviceSizeX, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripVisual->fDeviceSizeY, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripVisual->clSelectUnitSheet, sizeof(TColor));
    outStream->ReadBuffer(&_stripVisual->clSelectUnitOutline, sizeof(TColor));
    outStream->ReadBuffer(&_stripVisual->clDefaultUnitSheet, sizeof(TColor));
    outStream->ReadBuffer(&_stripVisual->clDefaultUnitOutline, sizeof(TColor));
    outStream->ReadBuffer(&_stripVisual->nAngle, sizeof(INT32));
    outStream->ReadBuffer(&_stripVisual->clIndicateLine, sizeof(TColor));
    outStream->ReadBuffer(&_stripVisual->nOriginLocation, sizeof(INT32));

    outStream->ReadBuffer(&_stripUnits->fUnitXSize, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripUnits->fUnitYSize, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripUnits->fUnitXPitch, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripUnits->fUnitYPitch, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripUnits->nUnitXCountPerBlock, sizeof(INT32));
    outStream->ReadBuffer(&_stripUnits->nUnitYCountPerBlock, sizeof(INT32));
    outStream->ReadBuffer(&_stripUnits->fFirstMarkToUnitCenterX, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripUnits->fFirstMarkToUnitCenterY, sizeof(FLOAT));

    outStream->ReadBuffer(&_stripBlock->nBlockXCount, sizeof(INT32));
    outStream->ReadBuffer(&_stripBlock->nBlockYCount, sizeof(INT32));
    outStream->ReadBuffer(&_stripBlock->fBlockXPitch, sizeof(FLOAT));
    outStream->ReadBuffer(&_stripBlock->fBlockYPitch, sizeof(FLOAT));

    _stripVisual->SetAngle(_stripVisual->nAngle);

    delete outStream;
    return true;
}
开发者ID:japgo,项目名称:mygithub,代码行数:35,代码来源:stripinfo.cpp

示例2: ReadingBinary

void __fastcall TFolderCheck::ReadingBinary(char *FilePath,char *FilePath2)
{
  replace=true;
  char *Buffer = NULL;
  char *Buffer2 = NULL;
  TFileStream *PktFile = NULL;
  TFileStream *PktFile2 = NULL;
        PktFile = new TFileStream( FilePath, fmOpenRead | fmShareDenyNone );
        PktFile2 = new TFileStream( FilePath2, fmOpenRead | fmShareDenyNone );
      if ( PktFile ){
	  Buffer = new char[ PktFile->Size ];
	  PktFile->ReadBuffer( Buffer, PktFile->Size );
          }
        if ( PktFile2 ){
	  Buffer2 = new char[ PktFile2->Size ];
	  PktFile2->ReadBuffer(Buffer2, PktFile2->Size );
          }

         if ( (int)(PktFile->Size)==(int)(PktFile2->Size) || (PktFile->Size ==0 && PktFile2->Size==0)){
         replace=false;
         int p=1000;
         if ( p >(int)(PktFile2->Size))
         {
         p=(int)(PktFile2->Size);
         }
        for (int i=0; i<p ;i++)
        {
          if (Buffer[i]==Buffer2[i])
                {
                 replace=false;
                }
          else  {
                 replace=true;
                 break;
                }

        }
}

      if ( PktFile ){
      delete PktFile;
      PktFile = NULL;}

    if ( PktFile2 ){
      delete PktFile2;
      PktFile = NULL;}

    if ( Buffer ){
      delete[] Buffer;
      Buffer = NULL;}

    if ( Buffer2 ){
      delete[] Buffer2;
      Buffer2 = NULL;}

    if (replace)
             {
             Log->Write("FilePath2 : "+AnsiString(FilePath2));
             Log->Write("FilePath  : "+AnsiString(FilePath));
             Log->Write("File old. Need to update ...");
          /*   string StrPath = FilePath;
             char str2[] = "C:\\DPSUpdate";
             StrPath.erase(0,strlen(str2));
             Log->Write(StrPath.c_str());
             char *mychar = new char[StrPath.length()+1];
             strcpy(mychar, StrPath.c_str());
             mychar[strlen(mychar)-strlen(strrchr(mychar,'\\'))]='\0';
             strcat(CurBackUp,mychar);
             Log->Write("Preready folder: "+AnsiString(CurBackUp));
             CheckFolder(CurBackUp,0,0);     */
             BUCopyFile(FilePath, CurBackUp);
             Log->Write("After folder: "+AnsiString(CurBackUp));
   //printf("pos: %d\n", strstr(str, "abc") - str);

             //Log->Write("Updating file ...");
             //DeleteFile(FilePath);

             CopyFile(FilePath2,FilePath,false);
             }
    else {
             Log->Write("FilePath  : "+AnsiString(FilePath));
             Log->Write("FilePath2 : "+AnsiString(FilePath2));
             Log->Write("Newest version of this file");
             }
replace = false;
}
开发者ID:unuservize,项目名称:Updater,代码行数:86,代码来源:TFolderCheck.cpp


注:本文中的TFileStream::ReadBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。