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


C++ CloseFile函数代码示例

本文整理汇总了C++中CloseFile函数的典型用法代码示例。如果您正苦于以下问题:C++ CloseFile函数的具体用法?C++ CloseFile怎么用?C++ CloseFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: CloseFile

void QuickView::ShowFile(const string& FileName, bool TempFile, PluginHandle* hDirPlugin)
{
	CloseFile();

	if (!IsVisible())
		return;

	if (FileName.empty())
	{
		ProcessingPluginCommand++;
		Show();
		ProcessingPluginCommand--;
		return;
	}

	string FileFullName = FileName;
	if (!hDirPlugin) ConvertNameToFull(FileFullName, FileFullName);

	bool SameFile = strCurFileName == FileFullName;
	strCurFileName = FileFullName;

	size_t pos = strCurFileName.rfind(L'.');
	if (pos != string::npos)
	{
		string strValue;

		if (GetShellType(strCurFileName.data()+pos, strValue))
		{
			api::reg::GetValue(HKEY_CLASSES_ROOT, strValue, L"", strCurFileType);
		}
	}

	if (hDirPlugin || api::fs::is_directory(strCurFileName))
	{
		// Не показывать тип файла для каталогов в "Быстром просмотре"
		strCurFileType.clear();

		if (SameFile && !hDirPlugin)
		{
			Directory=1;
		}
		else if (hDirPlugin)
		{
			int ExitCode=GetPluginDirInfo(hDirPlugin,strCurFileName,Data.DirCount,
			                              Data.FileCount,Data.FileSize,Data.AllocationSize);
			Directory = (ExitCode ? 4 : 3);
			uncomplete_dirscan = (ExitCode == 0);
		}
		else
		{
			int ExitCode=GetDirInfo(MSG(MQuickViewTitle), strCurFileName, Data, getdirinfo_default_delay, nullptr, GETDIRINFO_ENHBREAK|GETDIRINFO_SCANSYMLINKDEF|GETDIRINFO_NOREDRAW);
			Directory = (ExitCode == -1 ? 2 : 1); // ExitCode: 1=done; 0=Esc,CtrlBreak; -1=Other
			uncomplete_dirscan = ExitCode != 1;
		}
	}
	else
	{
		if (!strCurFileName.empty())
		{
			QView.reset(new Viewer(GetOwner(), true));
			QView->SetRestoreScreenMode(false);
			QView->SetPosition(m_X1+1,m_Y1+1,m_X2-1,m_Y2-3);
			QView->SetStatusMode(0);
			QView->EnableHideCursor(0);
			OldWrapMode = QView->GetWrapMode();
			OldWrapType = QView->GetWrapType();
			QView->SetWrapMode(LastWrapMode);
			QView->SetWrapType(LastWrapType);
			QView->OpenFile(strCurFileName,FALSE);
		}
	}
	if (this->Destroyed())
		return;

	m_TemporaryFile = TempFile;

	Redraw();

	if (Parent()->ActivePanel() == this)
	{
		DynamicUpdateKeyBar();
		Parent()->GetKeybar().Redraw();
	}
}
开发者ID:Frankie-666,项目名称:farmanager,代码行数:84,代码来源:qview.cpp

示例2: file_close

short file_close(FILEH handle) {

	CloseFile(handle);
	return(0);
}
开发者ID:perabuss,项目名称:np2wii,代码行数:5,代码来源:dosio.c

示例3: process_data

stat_record_t process_data(char *wfile, int element_stat, int flow_stat, int sort_flows,
	printer_t print_header, printer_t print_record, time_t twin_start, time_t twin_end, 
	uint64_t limitflows, int tag, int compress, int do_xstat) {
common_record_t 	*flow_record;
master_record_t		*master_record;
nffile_t			*nffile_w, *nffile_r;
xstat_t				*xstat;
stat_record_t 		stat_record;
int 				done, write_file;

#ifdef COMPAT15
int	v1_map_done = 0;
#endif
	
	// time window of all matched flows
	memset((void *)&stat_record, 0, sizeof(stat_record_t));
	stat_record.first_seen = 0x7fffffff;
	stat_record.msec_first = 999;

	// Do the logic first

	// print flows later, when all records are processed and sorted
	// flow limits apply at that time
	if ( sort_flows ) {
		print_record = NULL;
		limitflows   = 0;
	}

	// do not print flows when doing any stats
	if ( flow_stat || element_stat ) {
		print_record = NULL;
		limitflows   = 0;
	}

	// do not write flows to file, when doing any stats
	// -w may apply for flow_stats later
	write_file = !(sort_flows || flow_stat || element_stat) && wfile;
	nffile_r = NULL;
	nffile_w = NULL;
	xstat  	 = NULL;

	// Get the first file handle
	nffile_r = GetNextFile(NULL, twin_start, twin_end);
	if ( !nffile_r ) {
		LogError("GetNextFile() error in %s line %d: %s\n", __FILE__, __LINE__, strerror(errno) );
		return stat_record;
	}
	if ( nffile_r == EMPTY_LIST ) {
		LogError("Empty file list. No files to process\n");
		return stat_record;
	}

	// preset time window of all processed flows to the stat record in first flow file
	t_first_flow = nffile_r->stat_record->first_seen;
	t_last_flow  = nffile_r->stat_record->last_seen;

	// store infos away for later use
	// although multiple files may be processed, it is assumed that all 
	// have the same settings
	is_anonymized = IP_ANONYMIZED(nffile_r);
	strncpy(Ident, nffile_r->file_header->ident, IDENTLEN);
	Ident[IDENTLEN-1] = '\0';

	// prepare output file if requested
	if ( write_file ) {
		nffile_w = OpenNewFile(wfile, NULL, compress, IP_ANONYMIZED(nffile_r), NULL );
		if ( !nffile_w ) {
			if ( nffile_r ) {
				CloseFile(nffile_r);
				DisposeFile(nffile_r);
			}
			return stat_record;
		}
		if ( do_xstat ) {
			xstat = InitXStat(nffile_w);
			if ( !xstat ) {
				if ( nffile_r ) {
					CloseFile(nffile_r);
					DisposeFile(nffile_r);
				}
				return stat_record;
			}
		}
	}

	// setup Filter Engine to point to master_record, as any record read from file
	// is expanded into this record
	// Engine->nfrecord = (uint64_t *)master_record;

	done = 0;
	while ( !done ) {
	int i, ret;

		// get next data block from file
		ret = ReadBlock(nffile_r);

		switch (ret) {
			case NF_CORRUPT:
			case NF_ERROR:
				if ( ret == NF_CORRUPT ) 
//.........这里部分代码省略.........
开发者ID:ETredgo,项目名称:NetflowDB,代码行数:101,代码来源:nfdump.c

示例4: CloseFile

CFileInStream::~CFileInStream()
{
	CloseFile();
}
开发者ID:dreamsxin,项目名称:PcManager,代码行数:4,代码来源:FileStream.cpp

示例5: CloseFile

vtkDCMParser::~vtkDCMParser()
{
  CloseFile();
  //delete [] aux_ret;
}
开发者ID:fedral,项目名称:paper,代码行数:5,代码来源:vtkDCMParser.cpp

示例6: CloseFile

AppenderFile::~AppenderFile()
{
    CloseFile();
}
开发者ID:Lyill,项目名称:TrinityCore,代码行数:4,代码来源:AppenderFile.cpp

示例7: while

bool RPCFile::ChannelReader::ReadData(void* dest, uint64_t numBytes)
{
	// When an error condition is encountered, m_file is set to NULL.
	if(!m_file)
		return false;

	uint64_t availOut = numBytes;
	char* writePtr = (char*)dest;

	uint64_t streamEnd = m_chanInfo->GetDataOffset() + m_chanInfo->GetCompressedSize();
	
	while( (availOut > 0) && (m_readOffset < streamEnd) )
	{
		// We need to position the read pointer each time to notify the file reader that we've
		// consumed the bytes returned by GetBuffer().
		m_file->SetReadPtr(m_readOffset);

		// Get a pointer to the data present in the reader's cache.
		uint32_t bufferSize;
		m_inflateCtx.next_in = (const Bytef*)m_file->GetBuffer(&bufferSize);
		if(!m_inflateCtx.next_in)
		{
			CloseFile();
			return false;
		}

		// Make sure we don't run past the end of the channel.
		uint64_t availIn = streamEnd - m_readOffset;
		if(availIn > bufferSize)
			availIn = bufferSize;

		m_inflateCtx.avail_in = (uInt)availIn;

		// zlib uses 32-bit sizes, so we need to clamp the size in case somebody really wants to
		// read more than 4 GB in one go. This isn't a problem for availIn because bufferSize is 32-bit.
		m_inflateCtx.avail_out = (uInt)((availOut < UINT_MAX) ? availOut : UINT_MAX);
		m_inflateCtx.next_out = (Bytef*)writePtr;

		int inflateResult = inflate(&m_inflateCtx, Z_NO_FLUSH);
		if( (inflateResult != Z_OK) && (inflateResult != Z_STREAM_END) )
		{
			CloseFile();
			return false;
		}

		uint32_t readBytes = (uint32_t)(availIn - m_inflateCtx.avail_in);
		m_readOffset += readBytes;

		if( (m_readOffset == streamEnd) && (inflateResult != Z_STREAM_END) )
		{
			// We've reached the end of the compressed data, but zlib doesn't think so.
			CloseFile();
			return false;
		}

		if( (inflateResult == Z_STREAM_END) && (m_readOffset != streamEnd) )
		{
			// zlib says the stream ended, but we have more data in the file.
			CloseFile();
			return false;
		}

		uint64_t writtenBytes = availOut - m_inflateCtx.avail_out;
		writePtr += writtenBytes;
		availOut -= writtenBytes;
	}

	if(availOut > 0)
	{
		// If we reached the end of the stream without filling up the output buffer, it's
		// an error on the caller's side.
		CloseFile();
		return false;
	}

	return true;
}
开发者ID:nextlimit,项目名称:realflow-file-formats,代码行数:77,代码来源:RPCReader.cpp

示例8: CloseFile

cElCompileFN::~cElCompileFN()
{
   CloseFile();
   delete mNamesLoc;
   delete mDicSymb;
}
开发者ID:archeos,项目名称:micmac-archeos,代码行数:6,代码来源:fnum_compile.cpp

示例9: SetFile

void cElCompileFN::MakeFileCpp(std::vector<Fonc_Num> vFoncs,bool SpecFCUV)
{

   SetFile("cpp","h");

   int aDimOut = (int)vFoncs.size();


// Constructeur : 

   (*this) << mNameClass << "::" << mNameClass << "():\n";
   (*this) << "    cElCompiledFonc(" <<  aDimOut << ")\n";
   (*this) << "{\n";


   const cMapIncInterv & aMap =  mListInterv.Map();
   for (tCSetIII itCur = aMap.begin() ; itCur != aMap.end() ; itCur++)
   {
      (*this) << "   AddIntRef (cIncIntervale("
              <<  "\"" <<  itCur->Id()  <<  "\"" 
              <<  "," << itCur->I0Alloc()
              <<  "," << itCur->I1Alloc()
              << "));\n";
   }

   (*this) << "   Close(false);\n";

   (*this) << "}\n";
   (*this) << "\n\n\n";


   MakeFonc(vFoncs,0,SpecFCUV);
   MakeFonc(vFoncs,1,SpecFCUV);
   MakeFonc(vFoncs,2,SpecFCUV);

// Calcul des Fonction SetVar
   (*this) << "\n";
   for (cECFN_SetString::const_iterator it = mNamesLoc->begin(); it!=mNamesLoc->end() ; it++)
   {
       (*this)  << "void " << mNameClass << "::Set"<< it->Name() << "(double aVal){ "
                << NameVarLoc(it->Name()) << " = aVal;}\n";
   }
   (*this) << "\n\n\n";


// Fonction AdrVarLocFromString : 
   (*this) << "double * " << mNameClass << "::AdrVarLocFromString(const std::string & aName)\n";
   (*this) << "{\n";
   {
   for (cECFN_SetString::const_iterator it = mNamesLoc->begin(); it!=mNamesLoc->end() ; it++)
   {
       (*this)   << "   if (aName == \"" 
                 << (it->Name()) << "\") return & " 
                 << NameVarLoc(it->Name()) 
                 << ";\n";
   }
   }
   (*this) << "   return 0;\n";
   (*this) << "}\n\n\n";


   (*this)  << "cElCompiledFonc::cAutoAddEntry "  
	    << mNameClass << "::mTheAuto"
	    << "(\"" << mNameClass << "\"," 
	    << mNameClass << "::Alloc);\n\n\n";

   (*this)  << "cElCompiledFonc *  " << mNameClass << "::Alloc()\n";
   (*this)  << "{";
   (*this)  << "  return new " << mNameClass << "();\n";
   (*this)  << "}\n\n\n";

    
   CloseFile();
}
开发者ID:archeos,项目名称:micmac-archeos,代码行数:74,代码来源:fnum_compile.cpp

示例10: CloseFile

WavSplitWriter::~WavSplitWriter()
{
	CloseFile();
}
开发者ID:katakk,项目名称:BonTsDemuxMod,代码行数:4,代码来源:qE77TinkWavWriter.cpp

示例11: reduced_covers

int reduced_covers (FILE *descendant_file, FILE *covers_file, int k, int ***auts, struct pga_vars *pga, struct pcp_vars *pcp)
{
   int lower_step, upper_step;
   int nmr_of_covers = 0;
   int *a, *b;                  /* arrays needed for orbit calculation */
   char *c;                     /* array needed for stabiliser calculation */
   int **perms;                 /* store all permutations */
   int *orbit_length;           /* length of orbits */
   FILE * LINK_input;        /* input file for GAP */
#if defined (GAP_LINK) 
   Logical process_fork = FALSE; /* has GAP process forked? */        
#endif
   Logical soluble_group;       /* indicates that orbits and stabilisers may 
				   be computed using soluble machinery */

   /* calculate the extended automorphisms */
   extend_automorphisms (auts, pga->m, pcp);
   if (pcp->overflow) return 0;

   if (pga->print_extensions && pga->m != 0) {  
      printf ("\nThe extension%s:\n", pga->m == 1 ? " is" : "s are");
      print_auts (pga->m, pcp->lastg, auts, pcp);
   }

   /* find range of permitted step sizes */
   step_range (k, &lower_step, &upper_step, auts, pga, pcp);

   /* set up space for definition sets */
   store_definition_sets (pga->r, lower_step, upper_step, pga);

   /* loop over each permitted step size */ 
   for (pga->s = lower_step; pga->s <= upper_step; ++pga->s) {

      if (pga->trace)
	 trace_details (pga);

      get_definition_sets (pga);
      compute_degree (pga);

      /* establish which automorphisms induce the identity 
	 on the relevant subgroup of the p-multiplicator */
      strip_identities (auts, pga, pcp);

      /* if possible, use the more efficient soluble code --
	 in particular, certain extreme cases can be handled */
      soluble_group = (pga->soluble || pga->Degree == 1 || 
		       pga->nmr_of_perms == 0);

      if (!soluble_group) {
#if defined (GAP_LINK) 
	 if (!process_fork) {
	    start_GAP_file (auts, pga);
	    process_fork = TRUE;
	 }
	 StartGapFile (pga);
#else
#if defined (GAP_LINK_VIA_FILE) 
	 start_GAP_file (&LINK_input, auts, pga, pcp);
#endif
#endif
      }

      perms = permute_subgroups (LINK_input, &a, &b, &c, auts, pga, pcp);

      if (!pga->space_efficient) {
	 if (soluble_group)
	    compute_orbits (&a, &b, &c, perms, pga);
	 else
	    insoluble_compute_orbits (&a, &b, &c, perms, pga);
      }
      orbit_length = find_orbit_reps (a, b, pga);

      if (pga->print_orbit_summary)
	 orbit_summary (orbit_length, pga);

      if (soluble_group && pga->print_orbit_arrays)
	 print_orbit_information (a, b, c, pga);

      pga->final_stage = (pga->q == pga->multiplicator_rank);

      if (!soluble_group) {
#if defined (GAP_LINK_VIA_FILE) 
	 CloseFile (LINK_input);
#endif 
      }

      setup_reps (pga->rep, pga->nmr_orbits, orbit_length, perms, a, b, c, 
		  auts, descendant_file, covers_file, pga, pcp);

      if (!pga->final_stage)
	 nmr_of_covers += pga->nmr_orbits;

      free_space (soluble_group, perms, orbit_length, 
		  a, b, c, pga); 
   }     

#if defined (GAP_LINK)
   if (process_fork) 
      QuitGap ();
#endif 
//.........这里部分代码省略.........
开发者ID:fingolfin,项目名称:gap-osx-binary,代码行数:101,代码来源:reduced_covers.c

示例12: main


//.........这里部分代码省略.........
    filename=strcpy(malloc(strlen(argv[arg])+1),argv[arg]);

    fd=OpenFile(filename);

    if((p=strstr(filename,".bz2")) && !strcmp(p,".bz2"))
      {
       fd=Uncompress_Bzip2(fd);
       *p=0;
      }

    if((p=strstr(filename,".gz")) && !strcmp(p,".gz"))
      {
       fd=Uncompress_Gzip(fd);
       *p=0;
      }

    if((p=strstr(filename,".xz")) && !strcmp(p,".xz"))
      {
       fd=Uncompress_Xz(fd);
       *p=0;
      }

    printf("\nParse OSM Data [%s]\n==============\n\n",filename);
    fflush(stdout);

    if((p=strstr(filename,".pbf")) && !strcmp(p,".pbf"))
      {
       if(ParsePBFFile(fd,OSMNodes,OSMWays,OSMRelations))
          exit(EXIT_FAILURE);
      }
    else if((p=strstr(filename,".o5m")) && !strcmp(p,".o5m"))
      {
       if(ParseO5MFile(fd,OSMNodes,OSMWays,OSMRelations))
          exit(EXIT_FAILURE);
      }
    else
      {
       if(ParseOSMFile(fd,OSMNodes,OSMWays,OSMRelations))
          exit(EXIT_FAILURE);
      }

    CloseFile(fd);

    free(filename);
   }

 DeleteXMLTaggingRules();

 FinishNodeList(OSMNodes);
 FinishWayList(OSMWays);
 FinishRelationList(OSMRelations);

 /* Sort the data */

 printf("\nSort OSM Data\n=============\n\n");
 fflush(stdout);

 /* Sort the nodes, ways and relations */

 SortNodeList(OSMNodes);

 SortWayList(OSMWays);

 SortRelationList(OSMRelations);

 /* Process the data */

 RenameFile(OSMNodes->filename_tmp,OSMNodes->filename);
 RenameFile(OSMWays->filename_tmp,OSMWays->filename);
 RenameFile(OSMRelations->rrfilename_tmp,OSMRelations->rrfilename);
 RenameFile(OSMRelations->trfilename_tmp,OSMRelations->trfilename);

 close_errorlog();

 printf("\nCreate Error Log\n================\n\n");
 fflush(stdout);

 OSMErrorLogs=NewErrorLogList();

 ProcessErrorLogs(OSMErrorLogs,OSMNodes,OSMWays,OSMRelations);

 SortErrorLogsGeographically(OSMErrorLogs);

 SaveErrorLogs(OSMErrorLogs,FileName(dirname,prefix,"fixme.mem"));

 FreeErrorLogList(OSMErrorLogs);

 /* Free the memory (delete the temporary files) */

 FreeNodeList(OSMNodes,0);
 FreeWayList(OSMWays,0);
 FreeRelationList(OSMRelations,0);

 printf("\n");
 fflush(stdout);

 printf_program_end();

 exit(EXIT_SUCCESS);
}
开发者ID:svn2github,项目名称:routino,代码行数:101,代码来源:fixme-finder.c

示例13: CloseFile

CDummyVideoPlayer::~CDummyVideoPlayer()
{
  CloseFile();
}
开发者ID:SunSeosahai,项目名称:xbmc,代码行数:4,代码来源:DummyVideoPlayer.cpp

示例14: av_write_trailer

void AVIDump::Stop()
{
	av_write_trailer(s_format_context);
	CloseFile();
	NOTICE_LOG(VIDEO, "Stopping frame dump");
}
开发者ID:absolome,项目名称:dolphin,代码行数:6,代码来源:AVIDump.cpp

示例15: CloseFile

Log::~Log()
{
    CloseFile();
	DeleteCriticalSection( &m_criLock );	
}
开发者ID:tianyx,项目名称:TxUIProject,代码行数:5,代码来源:Log.cpp


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