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


C++ ofstream::close方法代码示例

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


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

示例1: calcNext

POINT WFD_Opt::calcNext(POINT &currPosition, int **map, int width, int height, int index) {

	cerr << "*********************** check calcGRID " << endl;
	_scanList = *(_scanLists[index]);

	//set current robot position
	_currentPos = currPosition;

	FRONTIER_LIST found;

	// NOTE: Optimization disabled:
	_frontiers.clear();

	static ofstream f_out;
	struct timeval startTime;
	struct timeval endTime;
	struct rusage ru;
	getrusage(RUSAGE_SELF, &ru);
	startTime = ru.ru_utime;

	found = findFrontiers(_currentPos, map, width, height);

	getrusage(RUSAGE_SELF, &ru);
	endTime = ru.ru_utime;
	double tS = startTime.tv_sec*1000000.0 + (startTime.tv_usec);
	double tE = endTime.tv_sec*1000000.0  + (endTime.tv_usec);
	double result = tE - tS;

	if (result != 0) {
//		f_out.open("exploration_execution_grid.txt", ios::app);
		f_out.open(_logFile, ios::app);
		f_out << tE - tS << endl;
		f_out.close();
	}

	list<POINT_LIST >::iterator frontierItr;

	//insert all found frontiers
	for (frontierItr = found.begin(); frontierItr != found.end(); ++frontierItr)
		_frontiers.push_back(*frontierItr);

	_scanList.clear();

	//cout <<  "DEBUG: total frontiers detected: " << _frontiers.size() << endl;

	//check if there's nothing left to explore
	if (_frontiers.size() == 0)
		return _currentPos;

	//get the lowest cost centroid

	return findBestCentroid(_frontiers, map, width, height);

//	FRONTIER_LIST::iterator itr = _frontiers.begin();
//	POINT currCentroid, bestCentroid;
//
//	bestCentroid = currCentroid = calcCentroid((*itr));
//	maxScore = currScore = itr->size() / euclidianDist(currCentroid, _currentPos);
//	POINT_LIST::iterator j = itr->begin();
//	cout << "DEBUG: Frontier (" << (*j).x << "," << (*j).y << ") size = " << std::fixed << std::setw(4) << itr->size() << " dist = " << std::setw(5) << std::setprecision(0) << euclidianDist(currCentroid, _currentPos) << " score = " << std::setw(5) << std::setprecision(2) << currScore << endl;
//	++itr;
//
//
//	for (; itr != _frontiers.end(); ++itr) {
//		currCentroid = calcCentroid((*itr));
//		currScore = itr->size() / euclidianDist(currCentroid, _currentPos);
//		j = itr->begin();
//		cout << "DEBUG: Frontier (" << (*j).x << "," << (*j).y << ") size = " << std::fixed << std::setw(4) << itr->size() << " dist = " << std::setw(5) << std::setprecision(0) << euclidianDist(currCentroid, _currentPos) << " score = " << std::setw(5) << std::setprecision(2) << currScore << endl;
//		if (currScore > maxScore) {
//			maxScore = currScore;
//			bestCentroid = currCentroid;
//		}
//	}

//	//DEBUG
//	cout << "frontiers are: " << endl;
//	for (itr = _frontiers.begin(); itr != _frontiers.end(); ++itr) {
//		cout << "{ " ;
//
//		POINT_LIST::iterator j = itr->begin();
////		for (; j != itr->end(); ++j)
////			cout << "(" << (*j).x << "," << (*j).y << ") " ;
//
//		cout << "(" << (*j).x << "," << (*j).y << ") " ;
//
//		cout << "} size = " << itr->size() << endl;
//	}

	//return bestCentroid;
	*(_scanLists[index]) = _scanList;
}
开发者ID:matankdr,项目名称:fast-frontier-detector,代码行数:91,代码来源:WFD_Opt.cpp

示例2: main

int main (int argc, char* argv[]) {
	int listSize = 0;
	int inversions = 0;
	string filename = "list";
	string sort_type = "";

	if (argc < 3) {
		cerr << USAGE_MESSAGE << endl;
		return -1;
	}

	// get the list size
	listSize = atoi(argv[1]);

	if (listSize <= 0) {
		cerr << "List size must be larger then zero." << endl;
		return -1;
	}

	// get the base filename
	filename = argv[2];

	// seed the random number generator
	srand(time(NULL));

	// open up the sorted and unsorted file streams
	sorted_list.open((filename + ".sorted").c_str());
	unsorted_list.open((filename + ".unsorted").c_str());

	// process rest of the command line based on the list type
	sort_type = argv[3];
	if (sort_type == "random") {  // generate a random list
		cout << "Generating a random list." << endl;
		generate_random(listSize);

	} else if (sort_type == "inorder") { // generate a list in order
		cout << "Generating an in-order list." << endl;
		generate_inorder(listSize);

	} else if (sort_type == "sortaorder") { // generate a list that's mostly in order
		if (argc != 5) {
			cerr << USAGE_MESSAGE_SORTAORDER << endl;
			return -1;
		}

		cout << "Generating a sorted list with random inversions." << endl;
		inversions = atoi(argv[4]);

		generate_sortaorder(listSize,inversions);

	} else if (sort_type == "revorder") { // generate a list in reverse order
		cout << "Generating a reverse in-order list." << endl;
		generate_inorder(listSize,true);

	} else if (sort_type == "revsortaorder") { // generate a list that's mostly in reverse order
		if (argc != 5) {
			cerr << USAGE_MESSAGE_REVSORTAORDER << endl;
			return -1;
		}

		cout << "Generating a reverse sorted list with random inversions." << endl;
		inversions = atoi(argv[4]);
		generate_sortaorder(listSize,inversions,true);

	} else {
		cerr << "Couldn't understand list type.  Possible values are "
			 << "random,inorder,sortaorder,revorder,revsortaorder." << endl;
		return -2;
	}

	// close the file streams
	sorted_list.close();
	unsorted_list.close();

	return 0;
}
开发者ID:Salimlou,项目名称:Class-Work,代码行数:76,代码来源:generator.cpp

示例3: main

int main(int argv,char*argc[])
{
    int n,i;
    int op[10];
    fin >> n;
    for(i=0; i <=n; ++i) op[i] = 0;
    op[n] = 2;
    i=1;
    int res,p,tmp;
    while(i>=1)
    {
        op[i]++;
        if(op[i]>3)
        {
            op[i] = 0;
            i--;
        }
        else if(i<n-1)
        {
            i++;
        }
        else
        {
            res = 0;
            p = 2;
            tmp = 0;
            for(int j=1;j<=n;++j)
            {
                tmp = tmp*10+j;
                if(op[j]!=1)
                {
                    if(p==2)
                    {
                        res += tmp;
                    }
                    else
                    {
                        res -= tmp;
                    }
                    p = op[j];
                    tmp = 0;
                }
            }
            if(res==0)
            {
                for(int j=1;j<=n;++j)
                {
                    fout << j;
                    if(j<n)
                    {
                        if(op[j]==1) fout << ' ';
                        else if(op[j]==2) fout << '+';
                        else if(op[j]==3) fout << '-';
                    }
                }
                fout << endl;
            }
        }
    }
    fin.close();
    fout.close();
    return 0;
}
开发者ID:GenguoWang,项目名称:usaco,代码行数:63,代码来源:zerosum.cpp

示例4: main

int main( int argc, char** argv )
{
	try
	{
		// Give usage information if no command line arguments were given
		if( argc == 1 )
		{
			cerr << "Usage: " << argv[0] << " [filename]" << endl;
			return 0;
		}
		
		// pass input filename to the initialization function
		initializeScanner( argv[1] );
		
		// Prepare output file
		initializeOutput();
		
		// Check status of input and output files
		if( inFile.good() == false )
		{
			cerr << "Error opening input file." << endl;
			return 0;
		}
		if( outFile.good() == false )
		{
			cerr << "Error opening file for output." << endl;
			
			inFile.close();
			return 0;
		}
		
		readProgram();
	}
	catch( exception& e )
	{
		cerr << e.what() << endl;
	}
	
	// If there were warnings and/or errors, leave a blank line before printing the summary.
	if( warningCount > 0 || errorCount > 0 )
	{
		cerr << endl;
	}
	
	// Output summary of number of lines read, number of errors, and number of warnings
	cout << "Summary" << endl;
	cout << "=======" << endl;
	cout << "Lines Read: " << lineNumber << endl;
	cout << "Errors: " << errorCount << endl;
	cout << "Warnings: " << warningCount << endl;
	
	inFile.close();
	outFile.close();
	
	if( errorCount > 0 )
	{
		remove( "narcomp_output.c" );
	}
	
	// Empty Symbol Tables
	// Global Symbol Table Entries
	for( SymbolTable::iterator janitor = globalSymbolTable.begin(); janitor != globalSymbolTable.end(); janitor++ )
	{
		delete janitor->second;
	}
	globalSymbolTable.clear();
	
	// Local Symbol Table Entries
	for( int i = 0; i < localSymbolTable.size(); i++ )
	{
		for( SymbolTable::iterator janitor = localSymbolTable[i].begin(); janitor != localSymbolTable[i].end(); janitor++ )
		{
			delete janitor->second;
		}
	}
	localSymbolTable.clear();
	
	return 0;
}
开发者ID:narayaha,项目名称:CompilerTheory,代码行数:79,代码来源:compiler.cpp

示例5: consumerHelperHonest


//.........这里部分代码省略.........
    p2p.Install (nodes.Get (13 + NUM_OF_CONSUMERS), nodes.Get (27 + NUM_OF_CONSUMERS));    // R13 <--> R27
    p2p.Install (nodes.Get (14 + NUM_OF_CONSUMERS), nodes.Get (15 + NUM_OF_CONSUMERS));    // R14 <--> R15
    p2p.Install (nodes.Get (14 + NUM_OF_CONSUMERS), nodes.Get (18 + NUM_OF_CONSUMERS));    // R14 <--> R18
    p2p.Install (nodes.Get (14 + NUM_OF_CONSUMERS), nodes.Get (19 + NUM_OF_CONSUMERS));    // R14 <--> R19
    p2p.Install (nodes.Get (15 + NUM_OF_CONSUMERS), nodes.Get (16 + NUM_OF_CONSUMERS));    // R15 <--> R16
    p2p.Install (nodes.Get (15 + NUM_OF_CONSUMERS), nodes.Get (19 + NUM_OF_CONSUMERS));    // R15 <--> R19
    p2p.Install (nodes.Get (15 + NUM_OF_CONSUMERS), nodes.Get (21 + NUM_OF_CONSUMERS));    // R15 <--> R21
    p2p.Install (nodes.Get (15 + NUM_OF_CONSUMERS), nodes.Get (22 + NUM_OF_CONSUMERS));    // R15 <--> R22
    p2p.Install (nodes.Get (15 + NUM_OF_CONSUMERS), nodes.Get (23 + NUM_OF_CONSUMERS));    // R15 <--> R23
    p2p.Install (nodes.Get (15 + NUM_OF_CONSUMERS), nodes.Get (25 + NUM_OF_CONSUMERS));    // R15 <--> R25
    p2p.Install (nodes.Get (15 + NUM_OF_CONSUMERS), nodes.Get (27 + NUM_OF_CONSUMERS));    // R15 <--> R27
    p2p.Install (nodes.Get (16 + NUM_OF_CONSUMERS), nodes.Get (23 + NUM_OF_CONSUMERS));    // R16 <--> R23
    p2p.Install (nodes.Get (16 + NUM_OF_CONSUMERS), nodes.Get (27 + NUM_OF_CONSUMERS));    // R16 <--> R27
    p2p.Install (nodes.Get (17 + NUM_OF_CONSUMERS), nodes.Get (23 + NUM_OF_CONSUMERS));    // R17 <--> R23
    // 18 done
    p2p.Install (nodes.Get (19 + NUM_OF_CONSUMERS), nodes.Get (22 + NUM_OF_CONSUMERS));    // R19 <--> R22
    p2p.Install (nodes.Get (20 + NUM_OF_CONSUMERS), nodes.Get (25 + NUM_OF_CONSUMERS));    // R20 <--> R25
    p2p.Install (nodes.Get (21 + NUM_OF_CONSUMERS), nodes.Get (22 + NUM_OF_CONSUMERS));    // R21 <--> R22
    p2p.Install (nodes.Get (21 + NUM_OF_CONSUMERS), nodes.Get (27 + NUM_OF_CONSUMERS));    // R21 <--> R27
    p2p.Install (nodes.Get (22 + NUM_OF_CONSUMERS), nodes.Get (23 + NUM_OF_CONSUMERS));    // R22 <--> R23
    p2p.Install (nodes.Get (22 + NUM_OF_CONSUMERS), nodes.Get (28 + NUM_OF_CONSUMERS));    // R22 <--> R28
    p2p.Install (nodes.Get (22 + NUM_OF_CONSUMERS), nodes.Get (29 + NUM_OF_CONSUMERS));    // R22 <--> R29
    p2p.Install (nodes.Get (23 + NUM_OF_CONSUMERS), nodes.Get (24 + NUM_OF_CONSUMERS));    // R23 <--> R24
    p2p.Install (nodes.Get (23 + NUM_OF_CONSUMERS), nodes.Get (25 + NUM_OF_CONSUMERS));    // R23 <--> R25
    p2p.Install (nodes.Get (23 + NUM_OF_CONSUMERS), nodes.Get (27 + NUM_OF_CONSUMERS));    // R23 <--> R27
    // 24 done
    // 25 done
    p2p.Install (nodes.Get (26 + NUM_OF_CONSUMERS), nodes.Get (27 + NUM_OF_CONSUMERS));    // R26 <--> R27
    // 27 done
    // 28 done
    // 29 done

    // Connecting producer(s)
    int producerId = 0 + NUM_OF_CONSUMERS + NUM_OF_ROUTERS;
    p2p.Install (nodes.Get (producerId), nodes.Get (0 + NUM_OF_CONSUMERS));      // P0 <--> R0


    // Install NDN stack without cache
    ndn::StackHelper ndnHelperNoCache;
    // ndnHelperNoCache.SetDefaultRoutes(true);
    ndnHelperNoCache.SetOldContentStore("ns3::ndn::cs::Nocache"); // no cache
    // Install on consumers
    for (int i = 0; i < NUM_OF_CONSUMERS; i++) {
      ndnHelperNoCache.Install(nodes.Get(i));
    }
    // Install on producer(s)
    ndnHelperNoCache.Install(nodes.Get(0 + NUM_OF_CONSUMERS + NUM_OF_ROUTERS));


    // Install NDN stack with cache
    ndn::StackHelper ndnHelperWithCache;
    // ndnHelperWithCache.SetDefaultRoutes(true);
    ndnHelperWithCache.SetOldContentStore("ns3::ndn::cs::Freshness::Lru", "MaxSize", "0");
    // Install on routers
    for (int i = NUM_OF_CONSUMERS; i < NUM_OF_CONSUMERS + NUM_OF_ROUTERS; i++) {
      ndnHelperWithCache.InstallWithCallback(nodes.Get(i), (size_t)&ForwardingDelay, i, USE_PINT);
    }

        // Consumers
    ndn::AppHelper consumerHelperHonest("ns3::ndn::AccountingEncrConsumer");
    // Consumer will request /prefix/A/0, /prefix/A/1, ...
    consumerHelperHonest.SetAttribute("Frequency", StringValue("1")); // 10 interests a second
    consumerHelperHonest.SetAttribute("Randomize", StringValue("uniform"));
    consumerHelperHonest.SetAttribute("StartSeq", IntegerValue(0));
    for(int i=0; i < NUM_OF_CONSUMERS; i++) {
      consumerHelperHonest.SetPrefix("/prefix/A/" + std::to_string(i));
      ApplicationContainer consumer = consumerHelperHonest.Install(nodes.Get(i));
      consumer.Start(Seconds(0));

      std::ostringstream node_id;
      node_id << i;
      Config::ConnectWithoutContext("/NodeList/" + node_id.str() + "/ApplicationList/0/ReceivedMeaningfulContent", MakeCallback(ReceivedMeaningfulContent));
    }

    // Producer
    ndn::AppHelper producerHelper("ns3::ndn::AccountingEncrProducer");
    // Producer will reply to all requests starting with /prefix/A. For /prefix/B we expect NACK
    producerHelper.SetPrefix("/prefix/A");
    producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
    producerHelper.Install(nodes.Get(producerId));

    ndn::GlobalRoutingHelper ndnGlobalRoutingHelper;
    ndnGlobalRoutingHelper.Install(nodes);

    std::string prefix = "/prefix/A";
    ndnGlobalRoutingHelper.AddOrigins(prefix, nodes.Get(producerId));

    ndn::GlobalRoutingHelper::CalculateRoutes();

    // Traces
    ndn::L3RateTracer::InstallAll(RATE_OUTPUT_FILE_NAME, Seconds(1.0));

    Simulator::Stop(Seconds(SIMULATION_DURATION));

    Simulator::Run();
    Simulator::Destroy();

    delayFile.close();
    return 0;
  }
开发者ID:chris-wood,项目名称:ndnSIM-accounting,代码行数:101,代码来源:ndn-dfn-pint-generation-overhead_Cr320-NOPINTENCR.cpp

示例6: Close

//______________________________________
void Close() {
gPeaksFile.close(); 
exit(-1); 
}
开发者ID:moukaddam,项目名称:SPICEAnalysis,代码行数:5,代码来源:PeakSearch_207Bi_interactive.C

示例7: write

 ~SampleFastaFile(void) {
     write(""); // flush
     fastafile << linebuffer << endl;
     fastafile.close();
 }
开发者ID:ekg,项目名称:mutatrix,代码行数:5,代码来源:mutatrix.cpp

示例8: main

z main(){ z map[50][50], M, N;
    for(z i=0;i<50;i++)for(z j=0;j<50;j++)r[i][j]=NULL;
    if(!in.good()){cerr<<"Couldn't open fiel.\n";return 1;}
    in>>N; in>>M;
    for(z i=0;i<M;i++){
        for(z j=0;j<N;j++){ z t;
            in>>t;
            map[i][j] = 0x1111;
            if(t>=8){t-=8;map[i][j]&=~0x0001;}   //S
            if(t>=4){t-=4;map[i][j]&=~0x0010;}   //E
            if(t>=2){t-=2;map[i][j]&=~0x0100;}   //N
            if(t>=1){t-=1;map[i][j]&=~0x1000;}   //W
            //cerr<< hex << map[i][j] << ' ';
        }
        //cerr<<endl;
    }
    for(z i=0;i<M;i++){
        for(z j=0;j<N;j++){
            if(map[i][j]&0x1000 && (map[i][j]&0x0100) ) {//no N or W
                //cerr << "NW! ";
                r[i][j]=r[i-1][j];
                r[i][j]->addRoom(i,j);
                if(r[i][j]!=r[i][j-1]) r[i][j]->merge(r[i][j-1]);
            } else if(map[i][j]&0x0100){//no N
                //cerr << "N ! ";
                r[i][j]=r[i-1][j];
                r[i][j]->addRoom(i,j);
                if(j)r[i][j-1]->addNeighbour(i+1,j,1,r[i][j]);
            } else if(map[i][j]&0x1000){//no W
                //cerr << "W ! ";
                r[i][j]=r[i][j-1];
                r[i][j]->addRoom(i,j);
                if(i)r[i-1][j]->addNeighbour(i+1,j+1,0,r[i][j]);
            } else {
                //out << i+1 << ' ' << j+1 << endl;
                //cerr << "  ! ";
                r[i][j]=new Room;
                r[i][j]->addRoom(i,j);
                if(j) r[i][j-1]->addNeighbour(i+1,j,1,r[i][j]);
                if(i) r[i-1][j]->addNeighbour(i+1,j+1,0,r[i][j]);
            }
        }
        //cerr<<endl;
    }
    out << dec << rc << endl;
    z rmax=0; z pmax=0,ta,tb,tc;
    for(z i=0;i<50;i++){ z a,b,c;
        if(!u[i])continue;
        if(u[i])rmax=max(u[i]->getSize(),rmax);
        if(u[i]){
            z x =u[i]->getRWSize(a,b,c);
            if(x>pmax){
                ta=a;tb=b;tc=c;
                pmax=x;
            } else if(x==pmax && (a<ta ||(ta==a&&b>tb)) ){
                ta=a;tb=b;tc=c;
            }
        }
    }
    out<< rmax<<endl;
    out<< pmax<<endl;
    if(!tc) {
        out<< tb << ' ' << ta << ' ';
        out<<"N\n";
    } else {
        out<< tb << ' ' << ta << ' ';
        out<<"E\n";
    }
    /*for(z i=0;i<M;i++){
        for(z j=0;j<N;j++){
            out<<r[i][j]->id<< ' ';
        }
        out<<endl;
    }*/
    out.close();
    //system("pause");
}
开发者ID:jnetterf,项目名称:contests,代码行数:77,代码来源:castle.cpp

示例9: main


//.........这里部分代码省略.........
					fire+=Ps[s][i][t];
				}
				
				IloNum wind(0);
				for(IloInt w=0;w<NW;++w)
					wind+=Pswind[s][t][w];
					
				Master_Model.add(fire==Pload[t]-wind);
				fire.end();
			}
			
			for(IloInt i=0; i<NG; ++i)//机组出力上下限约束
				for(IloInt t=0; t<NT; ++t)
				{
					Master_Model.add(Ps[s][i][t]<=Unit[i][2]*I[i][t]);//最好分开写
					Master_Model.add(Ps[s][i][t]>=Unit[i][1]*I[i][t]);
				}
			
			for(IloInt i=0; i<NG; ++i)//建议行为约束
				for(IloInt t=0; t<NT; ++t)
				{
					Master_Model.add(Ps[s][i][t]-P[i][t]<=ddtt[i]);
					Master_Model.add(-Ps[s][i][t]+P[i][t]<=ddtt[i]);
				}
			
			for(IloInt t=0; t<NT; ++t)//安全约束
			{
				IloExprArray Pf(env,Branch);//潮流
				IloExprArray Psp(env,Node-1);//注入功率
				IloExprArray Theta(env,Node);//相角
				
				Theta[Node-1]=IloExpr(env);
				for(IloInt k=0; k<Node-1; ++k)
				{
					Psp[k]=IloExpr(env);
					
					IloInt i=0;
					for(;i<NG;++i)
					{
						if(Unit[i][0]-1==k)break;
					}
					if(i<NG)
					{
						Psp[k] +=Ps[s][i][t];
					}
					if(Sw[k]>=0)
						Psp[k] += Pswind[s][t][ Sw[k] ];
					Psp[k] -= Sl[k]*Pload[t];
				}
				IloMutiply(env,B0l,Psp,Theta,Node-1);
				
				//计算潮流
				for(IloInt h=0; h<Branch; ++h)
				{
					Pf[h]=IloExpr(env);			
					Pf[h]+=(Theta[(IloInt)Info_Branch[h][0]-1]-Theta[(IloInt)Info_Branch[h][1]-1])/Info_Branch[h][3];
					Master_Model.add(Pf[h]<=Info_Branch[h][4]);
					Master_Model.add(Pf[h]>=-Info_Branch[h][4]);
				}
				Pf.end();
				Psp.end();
				Theta.end();
			}			
		}		
		Master_Cplex.solve();                        
/************************************************************输出显示过程**************************************************/
		if (Master_Cplex.getStatus() == IloAlgorithm::Infeasible)//输出结果
			output << "No Solution" << endl;

		output<<"Cost:"<<Master_Cplex.getObjValue()<<endl;
		for(IloInt i=0; i<NG; ++i)
		{
			for(IloInt t=0; t<NT; ++t)
			{
				output<<"机组 "<<i+1<<" 第 "<<t+1<<" 时段状态:"<<Master_Cplex.getValue(I[i][t])<<"   出力:";
				output<<Master_Cplex.getValue(P[i][t])<<endl;
			}
			output<<endl;
		}
		
		Master_Model.end();
		Master_Cplex.end();
		env.end();
	}
	catch(IloException& ex)//异常捕获
	{
		cerr<<"Error: "<<ex<<endl;
	}
	catch(...)
	{
		cerr << "Error: Unknown exception caught!" << endl;
	}

	finish=clock();
	totaltime=(double)(finish-start)/CLOCKS_PER_SEC;
	output<<"totaltime: "<<totaltime<<"s"<<endl<<endl;
	
	output.close();
	return 0;
}
开发者ID:zclzqbx,项目名称:walker-tmp,代码行数:101,代码来源:scuc_directly.cpp

示例10: Fini

static VOID Fini(INT32 code, VOID *v)
{
    outstream.close();
}
开发者ID:asudhak,项目名称:peachfuzz-code,代码行数:4,代码来源:instrumentation_order23.cpp

示例11:

Application::~Application() {
    if (g_debug.good()) {
        g_debug.close();
    }
}
开发者ID:7zhang,项目名称:studies,代码行数:5,代码来源:application.cpp

示例12: close_if_open

/* close_if_open closes the given output file stream if it is open
	parameters:
		file: a pointer to the output file stream to close
	returns: nothing
	notes:
	todo:
		TODO: check if this function is still being used
*/
void close_if_open (ofstream& file) {
	if (file.is_open()) {
		file.close();
	}
}
开发者ID:havu73,项目名称:circulating_clock_2014,代码行数:13,代码来源:io.cpp

示例13: qDeviceExplorationHook

/* Explore the Windows Multimedia Audio Mixers (mixerXxx) API, side-effecting the file system with some results.
	Call this from plugin initialization or some such. */
void qDeviceExplorationHook()
{
	// Get a place to stash results.
	qout.open("QwaqDeviceExploration.log", fstream::out | fstream::app);

	/* 
	int nDevices, i;
	char * name;
	double volume;
	nDevices = getNumberOfSoundPlayerDevices();
	qout << nDevices << " player devices:" << endl;
	for (i = 0; i<nDevices; i++) {
		name = getSoundPlayerDeviceName(i);
		qout << "	" << name;
		volume = getSoundPlayerVolume(name);
		setSoundPlayerVolume(volume + 0.1, name);
		qout << " was " << volume << " now " << getSoundPlayerVolume(name) << endl;;
		}
	//setDefaultSoundPlayer(getSoundPlayerDeviceName(0));
		
	nDevices = getNumberOfSoundRecorderDevices();
	qout << nDevices << " recorder devices:" << endl;
	for (i = 0; i<nDevices; i++) {
		char * name = getSoundRecorderDeviceName(i);
		qout << "	" << name;
		volume = getSoundRecorderVolume(name);
		qout << " was " << volume;
		if (volume < 0) volume = 0.5;
		qout << " set to " << setSoundRecorderVolume(volume + 0.1, name);
		qout << " now " << getSoundRecorderVolume(name) << endl;
		}
	//setDefaultSoundRecorder(getSoundPlayerDeviceName(0));
	*/

	const ALCchar *	devices;
	ALCchar *	ptr;
	devices = alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
	qout << endl << "default openAL device " << devices;
	devices = alcGetString(NULL, ALC_DEVICE_SPECIFIER);
	ptr = (ALCchar *) devices;
	while (!!*ptr)
	{
		qout << endl << "	" << ptr;
		while (!!*ptr++);
	}
	devices = alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER);
	qout << endl << "default openAL capture device " << devices;
	devices = alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER);
	ptr = (ALCchar *) devices;
	while (!!*ptr)
	{
		qout << endl << "	" << ptr;
		while (!!*ptr++);
	}

	qout << endl;
	//if (FAILED(DirectSoundEnumerate((LPDSENUMCALLBACK)DSEnumProc,(VOID*)" output"))) qout << "output enumeration failed" << endl;
	//if (FAILED(DirectSoundCaptureEnumerate((LPDSENUMCALLBACK)DSEnumProc,(VOID*) " capture"))) qout << "output enumeration failed" << endl;

	qout << endl;
	// cleanup
	qout.close();
}
开发者ID:SergeStinckwich,项目名称:openqwaq,代码行数:65,代码来源:qDevices.cpp

示例14: dataWrite

void dataWrite(int writer, int flag, double data1, double data2, double data3, double data4, double data5, double data6, double data7, double data8)
{
   if(writer==1)
   {
      //Initialization Writing	
      if(flag==0)
      {
         myfile.open("ballbeamdata.txt");
	 myfile << "DATA FROM BALL BEAM SIMULATION\n------------------------------\n";         
	 myfile << "The data in this file is in the following order:\n";
	 myfile << "Time of simulation, delta T for each step, Pink ball X, Pink ball Y, Orange ball X, Orange ball Y, Green ball X, Green ball Y, error, derivative error, integral error, control (u), motor encoder value.\n\n\n";
	 myfile << "motor speed (deg/sec) = ";         
	 myfile << data1;     
         myfile << "\nK = ";         
	 myfile << data2;     
	 myfile << "\nKdiff = ";         
	 myfile << data3;  
	 myfile << "\nKint = ";         
	 myfile << data4;  
      } 

      //Calibration (offset angle) Writing
      if(flag==1)
      {
    	 myfile << "\nInitial angle offset = ";   
    	 myfile << data1; 
    	 myfile << "\n\n\n"; 
      } 

      //Experimental Data Writing pt 1 (ball position info, time info)
      if(flag==2)
      {
         myfile << data1;
    	 myfile << ", ";
         myfile << data2;
    	 myfile << ", ";
         myfile << data3;
    	 myfile << ", ";
         myfile << data4;
    	 myfile << ", ";
         myfile << data5;
	 myfile << ", ";
         myfile << data6;
	 myfile << ", ";
         myfile << data7;
	 myfile << ", ";
         myfile << data8;
	 myfile << ", ";
      }


      //Experimental Data Writing pt 2 (controller info)
      if(flag==3)
      {
         myfile << data1;
    	 myfile << ", ";
         myfile << data2;
    	 myfile << ", ";
         myfile << data3;
    	 myfile << ", ";
         myfile << data4;
    	 myfile << ", ";
      }

      //Experimental Data Writing pt 3 (motor encoder info)
      if(flag==4)
      {
         myfile << data1;
         myfile << "\n";
      }


      //Close Output File When Done
      if(flag==5)
      {
         myfile.close();
         cout << "\nfile written!\n";
      }

   }

}
开发者ID:oosuagwu,项目名称:uiuc-lar,代码行数:82,代码来源:dataWrite.cpp

示例15:

core::~core()
{
	userFile.close();
	saveFile.close();
}
开发者ID:redigaffi,项目名称:Simple-RPG,代码行数:5,代码来源:system.cpp


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