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


C++ printToConsole函数代码示例

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


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

示例1: defined

void HelpMessageBox::showOrPrint()
{
#if defined(WIN32)
        // On Windows, show a message box, as there is no stderr/stdout in windowed applications
        exec();
#else
        // On other operating systems, print help text to console
        printToConsole();
#endif
}
开发者ID:wolfoxonly,项目名称:coc,代码行数:10,代码来源:guiutil.cpp

示例2: txt

int robot::getJointPosition(std::string jointName)
{
	for(size_t i = 0; i < vJoints.size() ; i++)
	{
		if(vJoints.at(i)->name == jointName){return i;}
	
	}
	std::string txt("ERROR: there is no joint with name '"+ jointName+"'");
	printToConsole(txt.c_str());
	return -1;
}
开发者ID:RhobanProject,项目名称:Vrep,代码行数:11,代码来源:robot.cpp

示例3: main

int main(int argc, char **argv)
{	
	int i;
	char buffer[1024];
	futex_init(&printFutex, 1);
	mythread_t mythread1[NTHREADS];
	mythread_t signalingThread[NTHREADS/2];
	mythread_setconcurrency(4);
	mythread_mutex_init(&mutex,NULL);
	mythread_cond_init(&condition,NULL);
	mythread_barrier_init(&barrier,NULL,NTHREADS+1);
	
	/* Create Threads */
	for(i=0;i<NTHREADS;i++){
		sprintf(buffer, "Created thread : %d\n", i+1);
		printToConsole(buffer);
		mythread_create(&mythread1[i],NULL,&thread_func, NULL);
	}
	
	/*Signal threads waiting on cond var*/
	while(count<NTHREADS){
		/* Special case for testing broadcast*/
		if(count == NTHREADS/2){
			mythread_cond_broadcast(&condition);
		}else{
			mythread_cond_signal(&condition);
		}
	}
	
	/* Waiting on barrier. Last thread, or this main thread will unblock the barrier depending on the execution sequence */
	mythread_barrier_wait(&barrier);
	sprintf(buffer, "Out of barrier, main thread exiting..\n");
	printToConsole(buffer);
	/* Destroy mutex, barrier and cond*/
	mythread_cond_destroy(&condition);
        mythread_mutex_destroy(&mutex);
	mythread_barrier_destroy(&barrier);
	sprintf(buffer, "Finished Execution\n");
	printToConsole(buffer);
}
开发者ID:Arjun-Code-Knight,项目名称:operating-systems,代码行数:40,代码来源:mytest.c

示例4: explode

//-- testfunction
void Spielfeld::explodeAll()
{
  Position pos;
  for(pos.y=0 ; pos.y < FELD_HEIGHT ; pos.y++){
    for(pos.x=0 ; pos.x < FELD_WIDTH ; pos.x++){
      if( getField(pos) == BOMBE )
      {
        explode(pos, ((Bombe*)feld[pos.x][pos.y])->getReichweite());
      }
    }
  }
  printToConsole();
}
开发者ID:eglimi,项目名称:netbomb,代码行数:14,代码来源:spielfeld.cpp

示例5: txt

void urdfLink::verifyInertia()
{
	float c=0.0f;
	for (int i=0;i<9;i++)
		c+=fabs(inertia[i]);
	if (c==0.0f)
	{
		std::string txt("ERROR: found an invalid inertia entry for link '"+ name+"'");
		printToConsole(txt.c_str());

		inertia[0]=0.001f;
		inertia[4]=0.001f;
		inertia[8]=0.001f;
	}
}
开发者ID:RhobanProject,项目名称:Vrep,代码行数:15,代码来源:link.cpp

示例6: consolePlayer

ChessMove consolePlayer(ChessBoard &board, int color) {
	string inputstr;
	ChessMove chessMove;
	printToConsole(board);
	while (true) {
		cout << '\n';
		cin >> inputstr;

		try {
			chessMove=stringToMove(board,inputstr);
			if (getColor(chessMove.piece)==color&&board.validateFromList(chessMove)) {
				return chessMove;
			} else cout << "Invalid move!\n";
		} catch (invalid_argument &ex) {
			cout << "Exception : " << ex.what() << '\n';
		}
	}
}
开发者ID:sammyer,项目名称:caveman-chess,代码行数:18,代码来源:Tests.cpp

示例7: if

void urdfLink::setMeshFilename(std::string packagePath,std::string meshFilename,std::string choose)
{
    std::cout << std::flush;

	std::string meshFilename_alt; // we use an alternative filename... the package location is somewhat strangely defined sometimes!!
	if (meshFilename.compare(0,10,"package://")==0) // condition added by Marc on 17/1/2014
	{
		meshFilename = meshFilename.substr(9,meshFilename.size()); //to delete de package:/ part
		meshFilename_alt=meshFilename;
		meshFilename = packagePath + meshFilename;
		packagePath = packagePath.substr(0, packagePath.find_last_of("/"));
		meshFilename_alt = packagePath + meshFilename_alt;
	}

	std::string extension = meshFilename.substr(meshFilename.size()-3,meshFilename.size());
	int nExtension;
	if(extension == "obj" || extension =="OBJ"){ nExtension = 0;}
	else if(extension == "dxf" || extension == "DXF"){ nExtension = 1;}
	else if(extension == "3ds" || extension == "3DS"){ nExtension = 2;}
	else if(extension == "stl" || extension == "STL"){ nExtension = 4;}
	else if(extension == "dae" || extension == "DAE"){ nExtension = 5;}
	else
	{
		nExtension = -1;
		std::string txt("ERROR: the extension '"+ extension +"' is not currently a supported.");
		printToConsole(txt.c_str());
	}

	if(choose == "visual")
	{
        urdfElement &visual = currentVisual();
		visual.meshFilename = meshFilename;
		visual.meshFilename_alt = meshFilename_alt;
		visual.meshExtension = nExtension;
	}
	if(choose == "collision")
	{
        urdfElement &collision = currentCollision();
		collision.meshFilename = meshFilename;
		collision.meshFilename_alt = meshFilename_alt;
		collision.meshExtension = nExtension;
	}
}
开发者ID:RhobanProject,项目名称:Vrep,代码行数:43,代码来源:link.cpp

示例8: thread_func

/* Each thread will increment the count (global) protected by mutex */
void* thread_func(void *arg)
{
	char buffer[1024];
	/*Lock Mutex*/
	int temp = 0;
	mythread_mutex_lock(&mutex);
	while(temp<1000){
		temp++;
	}
	/*Wait to increment until main thread signals*/
	mythread_cond_wait(&condition,&mutex);
	count++;
	mythread_enter_kernel();
	sprintf(buffer, "Incremented Count to : %d\n", count);
	printToConsole(buffer);
	mythread_leave_kernel();
	mythread_mutex_unlock(&mutex);
	/* Threads will wait on the barrier. Main thread will also wait */
	mythread_barrier_wait(&barrier);
	mythread_exit(NULL);	
}
开发者ID:Arjun-Code-Knight,项目名称:operating-systems,代码行数:22,代码来源:mytest.c

示例9: va_start

  void Tracer::output (TraceLevel level, const char *msg, ...)
  {
    if (level < minLevel){
      return;
    }

    {
      va_list ap;
      va_start (ap, msg);
      int len = vsnprintf (NULL, 0, msg, ap);
      va_end (ap);

      char out[len+1];

      va_start (ap, msg);
      vsnprintf (out, len+1, msg, ap);
      va_end (ap);

      printToConsole(level, out);
    }
  }
开发者ID:raumfeld,项目名称:stream-decoder,代码行数:21,代码来源:Trace.cpp

示例10: consoleGame

void consoleGame() {
	string inputstr;
	ChessMove chessMove;
	ChessBoard board;
	board.setup();
	for (int i=0;i<15;i++) {
		cout << '\n';
		cin >> inputstr;
		if (inputstr=="q") break;
		try {
			chessMove=stringToMove(board,inputstr);
			if (board.validateFromList(chessMove)) {
				board.applyMove(chessMove);
				printToConsole(board);
				printBoardStats(board,true,true);
			} else cout << "Invalid move!\n";
		} catch (invalid_argument &ex) {
			cout << "Exception : " << ex.what() << '\n';
		}
	}
}
开发者ID:sammyer,项目名称:caveman-chess,代码行数:21,代码来源:Tests.cpp

示例11: listCommands

void listCommands(){
	textColor = LIGHTGRAY;
	printToConsole("\tls \t\t\t\t\t\t- list all files\n");
	printToConsole("\tcat [file] \t\t\t\t- view contents of that file\n");
	printToConsole("\trm [file] \t\t\t\t- remove file with name\n");
	printToConsole("\tchmod [mode] [file] \t- change file permissions\n");
	printToConsole("\tte [file] \t\t\t\t- create or edit file with name\n");
	printToConsole("\twc [file] \t\t\t\t- reports lines, words, and characters of a file\n");
	printToConsole("\thistory \t\t\t\t- display previous 15 commands\n");
	printToConsole("\tsu [user] \t\t\t\t- switch current user\n");
	printToConsole("\tchown [user] [file]\t\t- change owner of a file\n");
	printToConsole("\tadduser [user]\t\t\t- add new user\n");
	printToConsole("\tdeluser [user]\t\t\t- remove user\n");
	printToConsole("\tlistus \t\t\t\t\t- list users\n");
	printToConsole("\techo [word]...\t\t\t- print text to screen\n");
	printToConsole("\tpasswd\t\t\t\t\t- change password for current user\n");
	printToConsole("\tpwd\t\t\t\t\t\t- print working directory\n");
	printToConsole("\tcd [folder]\t\t\t\t- change directory to folder\n");
	printToConsole("\tmkdir [directory]\t\t- make new directory\n");
	printToConsole("\trmdir [directory]\t\t- remove empty directory\n");
	printToConsole("\tmv [file] [directory]\t- move file to directory\n");
	/*
	printToConsole("\tcp [file] [new file]\t- make a copy of a file\n");
	printToConsole("\tdiff [file 1] [file 2]\t- compare two files\n");
	*/

}
开发者ID:thigley,项目名称:THOS,代码行数:27,代码来源:terminal.c

示例12: printToConsole

/*!
 *  Print line with a prefix to the console
 */
void Logger::withPrefix(String logPrefix, String string) {
    prefix = "[" + logPrefix + "]";
    printToConsole(string);
}
开发者ID:massivedanger,项目名称:matter,代码行数:7,代码来源:Logger.cpp

示例13: splash

void splash(){
	textColor = LIGHTRED;
	printToConsole(spashscreen);
	textColor = LIGHTGRAY;
}
开发者ID:thigley,项目名称:THOS,代码行数:5,代码来源:terminal.c

示例14: NYI

/* Programs.c */
void NYI(){
	printToConsole("Error: Command not yet implemented!\n");
}
开发者ID:thigley,项目名称:THOS,代码行数:4,代码来源:Programs.c

示例15: filenameAndPath

robot::robot(std::string filename,bool hideCollisionLinks,bool hideJoints,bool convexDecomposeNonConvexCollidables,bool createVisualIfNone,bool showConvexDecompositionDlg,bool centerAboveGround,bool makeModel,bool noSelfCollision,bool positionCtrl): filenameAndPath(filename)
{
	printToConsole("URDF import operation started.");
	openFile();
	readJoints();
	readLinks();
	readSensors();
	createJoints(hideJoints,positionCtrl);
	createLinks(hideCollisionLinks,convexDecomposeNonConvexCollidables,createVisualIfNone,showConvexDecompositionDlg);
	createSensors();

	std::vector<int> parentlessObjects;
	std::vector<int> allShapes;
	std::vector<int> allObjects;
	std::vector<int> allSensors;
	for (int i=0;i<int(vLinks.size());i++)
	{
        if (simGetObjectParent(vLinks[i]->nLinkVisual)==-1)
            parentlessObjects.push_back(vLinks[i]->nLinkVisual);
        allObjects.push_back(vLinks[i]->nLinkVisual);
        allShapes.push_back(vLinks[i]->nLinkVisual);

		if (vLinks[i]->nLinkCollision!=-1)
		{
			if (simGetObjectParent(vLinks[i]->nLinkCollision)==-1)
				parentlessObjects.push_back(vLinks[i]->nLinkCollision);
			allObjects.push_back(vLinks[i]->nLinkCollision);
			allShapes.push_back(vLinks[i]->nLinkCollision);
		}
	}
	for (int i=0;i<int(vJoints.size());i++)
	{
		if (vJoints[i]->nJoint!=-1)
		{
			if (simGetObjectParent(vJoints[i]->nJoint)==-1)
				parentlessObjects.push_back(vJoints[i]->nJoint);
			allObjects.push_back(vJoints[i]->nJoint);
		}
	}
	for (int i=0;i<int(vSensors.size());i++)
	{
		if (vSensors[i]->nSensor!=-1)
		{
			if (simGetObjectParent(vSensors[i]->nSensor)==-1)
				parentlessObjects.push_back(vSensors[i]->nSensor);
			allObjects.push_back(vSensors[i]->nSensor);
			allSensors.push_back(vSensors[i]->nSensor);
		}
		if (vSensors[i]->nSensorAux!=-1)
		{
			allObjects.push_back(vSensors[i]->nSensorAux);
			allSensors.push_back(vSensors[i]->nSensorAux);
		}
	}

	// If we want to alternate respondable mask:
	if (!noSelfCollision)
	{
		for (int i=0;i<int(parentlessObjects.size());i++)
			setLocalRespondableMaskCummulative_alternate(parentlessObjects[i],true);
	}

	// Now center the model:
	if (centerAboveGround)
	{
		bool firstValSet=false;
		C3Vector minV,maxV;
		for (int shNb=0;shNb<int(allShapes.size());shNb++)
		{
			float* vertices;
			int verticesSize;
			int* indices;
			int indicesSize;
			if (simGetShapeMesh(allShapes[shNb],&vertices,&verticesSize,&indices,&indicesSize,NULL)!=-1)
			{
				C7Vector tr;
				simGetObjectPosition(allShapes[shNb],-1,tr.X.data);
				C3Vector euler;
				simGetObjectOrientation(allShapes[shNb],-1,euler.data);
				tr.Q.setEulerAngles(euler);
				for (int i=0;i<verticesSize/3;i++)
				{
					C3Vector v(vertices+3*i);
					v*=tr;
					if (!firstValSet)
					{
						minV=v;
						maxV=v;
						firstValSet=true;
					}
					else
					{
						minV.keepMin(v);
						maxV.keepMax(v);
					}
				}
				simReleaseBuffer((char*)vertices);
				simReleaseBuffer((char*)indices);
			}
		}
//.........这里部分代码省略.........
开发者ID:RhobanProject,项目名称:Vrep,代码行数:101,代码来源:robot.cpp


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