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


C++ System函数代码示例

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


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

示例1: callSuperIsoSLHA

int callSuperIsoSLHA(void)
{  char* command;
   int err;
   char * path=getenv("superIso");
   if(!path) { printf("Define environment variable 'superIso' to specify path to the package\n"); return -1;}
   command=malloc(strlen(path)  +100);
   sprintf(command,"%s/slha.x",path); 
   if(access(command,X_OK))
   { int sysTimeLimTmp=sysTimeLim;
     sysTimeLim=0;
     System("cd %s; make; make slha",path);
     sysTimeLim=sysTimeLimTmp;
   }
   if(access(command,X_OK)) 
   { printf("Can not compile superIso\n");
     free(command);
     return -2;
   }
   slhaWrite("slhaForSuperIso");
   System("%s  slhaForSuperIso >/dev/null  ",command);
   err=slhaRead("output.flha",1);
   unlink("slhaForSuperIso");
   if(delFiles) unlink("output.flha");  
   free(command);
   return err;
}
开发者ID:jotadram6,项目名称:micrOMEGAs,代码行数:26,代码来源:superIso.c

示例2: sbcl_bin_install

int sbcl_bin_install(struct install_options* param) {
  char* version=param->version;
  char* arch=param->arch;
  char* home=configdir();
  char *str,*str2,*str3,*str4;
  char* version_num= q(version);
  int ret;
  str2=cat(home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\sbcl.exe",NULL);
  str3=cat(home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\bin\\sbcl.exe",NULL);
  str=cat("cmd /c \"echo f|xcopy ^\"",str2,"^\" ^\"",str3,"^\" > NUL","\"",NULL);
  s(str2),s(str3);
  ret=System(str);s(str);
  if(ret) return 0;
  str2=cat(home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\sbcl.core",NULL);
  str3=cat(home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\lib\\sbcl\\sbcl.core",NULL);
  str=cat("cmd /c \"echo f|xcopy ^\"",str2,"^\" ^\"",str3,"^\" > NUL","\"",NULL);
  ret=System(str);s(str);
  if(ret) return 0;
  str=cat("echo d|xcopy ^\"",
          home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\contrib^\" ^\"",
          home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\lib\\sbcl\\contrib^\" >NUL",NULL);

  str2=cat(home,"src\\sbcl-",version,"-",arch,"-windows\\PFiles\\Steel Bank Common Lisp\\",version_num,"\\contrib",NULL);
  str3=cat(home,"impls\\",arch,"\\windows\\sbcl-bin\\",version,"\\lib\\sbcl\\contrib",NULL);
  str=cat("cmd /c \"echo d|xcopy ^\"",str2,"^\" ^\"",str3,"^\""," > NUL","\"",NULL);
  ret=System(str);
  s(str),s(home);
  if(ret) return 0;
  return 1;
} 
开发者ID:biwakonbu,项目名称:roswell,代码行数:30,代码来源:install-sbcl-bin_windows.c

示例3: CmdWorker

int
CmdWorker(q_msg *m)
{
	char *c = &(m->cmd[0]);	
	char s[MAX_MSGLEN];
	int rc; 

	NETDEBUG(MEXECD, NETLOG_DEBUG2, ("To: %x From: %x Flag: %x Cmd: %s\n",
		m->self_id, m->peer_id, m->flag, c));
	
	if (ISSET_BIT(m, OUT_BIT)) {
		rc = System(c, s, MAX_CMDLEN);	
	}
	else {
		rc = System(c, NULL, 0);
		s[0]='\0';
	}

	NETDEBUG(MEXECD, NETLOG_DEBUG2, ("Cmd returned %d\n", rc));

	if (ISSET_BIT(m, REQ_BIT)) {
		strncpy(c, s, MAX_CMDLEN);
		SendResp(m, rc);
	}

	free(m);

	return(rc);
}
开发者ID:AkankshaGovil,项目名称:Automation,代码行数:29,代码来源:main.c

示例4: main

int main()
{
    printf("client: %d\n", getpid());

    int stop = 0;
    while (stop)
    {
        fprintf(stderr, ".");
        sleep(1);
    }

    Handle<es::Stream> output = System()->getOutput();
    output->write("hello!\n", 7);

    Handle<es::Context> nameSpace = System()->getRoot();


    Handle<es::Iterator> iterator = nameSpace->list("");
    while (iterator->hasNext())
    {
        char name[128];

        Handle<es::Binding> binding = iterator->next();
        if (binding->getName(name, sizeof name))
        {
            output->write(name, strlen(name));
            output->write("\n", 1);
        }
    }
    return 0;
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:31,代码来源:client.cpp

示例5: eiso

rt_public EIF_BOOLEAN eiso(EIF_REFERENCE target, EIF_REFERENCE source)
{
	/* Compare `source ' and `target' in term of their structure:
	 * 1/ direct instances should be equal.
	 * 2/ references should be of the same dynamic type.
	 * It assumes that dynamic types of `source' and `target' are the
	 * same.
	 * Return a boolean.
	 */

	if (target == source)
		return EIF_TRUE;

#ifdef DEBUG
	dprintf(2)("eiso: source = 0x%lx [%s] target = 0x%lx [%s]\n",
		source, System(Dtype(source)).cn_generator,
		target, System(Dtype(target)).cn_generator);
#endif

		/* Check if the dynamic types are the same */
	if (Dftype(source) != Dftype(target)) {
		return EIF_FALSE;
	} else {
			/* Check iomorphism */
		return e_field_iso(target, source);
	}
}
开发者ID:tioui,项目名称:EiffelStudio,代码行数:27,代码来源:equal.c

示例6: main

int main(int argc, char* argv[])
{
    esReport("This is the upcall test server process.\n");

    // System()->trace(true);

    Handle<es::Context> nameSpace = System()->getRoot();
    Handle<es::CurrentThread> currentThread = System()->currentThread();

    // create server
    TestServer* server = new TestServer;

    // register this console.
    Handle<es::Context> device = nameSpace->lookup("device");
    ASSERT(device);
    es::Binding* ret = device->bind("testServer", static_cast<es::Stream*>(server));
    ASSERT(ret);
    ret->release();

    while (1 < server->ref)
    {
        currentThread->sleep(10000000LL);
    }

    server->release();

    System()->trace(false);
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:28,代码来源:upcallTest.cpp

示例7: test27c

void test27c()
{				/* Test error response. */
  struct stat st;
  int fd, i;

  subtest = 3;

  System("echo Hi > foo");	/* Make a file called foo. */
  /* Check if a un searchable dir is handled ok. */
  Chdir("..");			/* cd .. */
  System("chmod 677 DIR_27");	/* no search permission */
  if (stat("DIR_27/nono", &st) != -1) e(1);
  if (superuser) {
	if (errno != ENOENT) e(2);	/* su has access */
  }
  if (!superuser) {
	if (errno != EACCES) e(3);	/* we don't ;-) */
  }
  System("chmod 777 DIR_27");
  Chdir("DIR_27");		/* back to test dir */

  /* Check on ToLongName etc. */
#ifdef _POSIX_NO_TRUNC
# if _POSIX_NO_TRUNC - 0 != -1
  if (stat(ToLongName, &st) != -1) e(4);	/* name is too long */
  if (errno != ENAMETOOLONG) e(5);
# endif
#else
# include "error, this case requires dynamic checks and is not handled"
#endif
  if (stat(ToLongPath, &st) != -1) e(6);	/* path is too long */
  if (errno != ENAMETOOLONG) e(7);

  /* Test some common errors. */
  if (stat("nono", &st) != -1) e(8);	/* nono nonexistent */
  if (errno != ENOENT) e(9);
  if (stat("", &st) != -1) e(10);	/* try empty */
  if (errno != ENOENT) e(11);
  if (stat("foo/bar", &st) != -1) e(12);	/* foo is a file */
  if (errno != ENOTDIR) e(13);

  /* Test fstat on file descriptors that are not open. */
  for (i = 3; i < 6; i++) {
	if (fstat(i, &st) != -1) e(14);
	if (errno != EBADF) e(15);
  }

  /* Test if a just closed file is `fstat()'-able. */
  if ((fd = open("foo", O_RDONLY)) != 3) e(16);	/* open foo */
  if (fstat(fd, &st) != 0) e(17);	/* get stat */
  if (close(fd) != 0) e(18);	/* close it */
  if (fstat(fd, &st) != -1) e(19);	/* get stat */
  if (errno != EBADF) e(20);
  System("rm -rf ../DIR_27/*");
}
开发者ID:Spenser309,项目名称:CS551,代码行数:55,代码来源:test27.c

示例8: test30c

void test30c()
{
  int fd, does_truncate;

  subtest = 3;

  System("rm -rf ../DIR_30/*");

  if (!superuser) {
	/* Test if creat is not usable to open files with the wrong mode */
	System("> nono; chmod 177 nono");
	fd = creat("nono", 0777);
	if (fd != -1) e(1);
	if (errno != EACCES) e(2);
  }
  if (mkdir("bar", 0777) != 0) e(3);	/* make bar */

  /* Check if no access on part of path generates the correct error. */
  System("chmod 577 bar");	/* r-xrwxrwx */
  if (!superuser) {
	/* Normal users can't creat without write permision. */
	if (creat("bar/nono", 0666) != -1) e(4);
	if (errno != EACCES) e(5);
	if (creat("bar/../nono", 0666) != -1) e(6);
	if (errno != EACCES) e(7);
  }
  if (superuser) {
	/* Super user can still creat stuff. */
	if ((fd = creat("bar/nono", 0666)) != 3) e(8);
	if (close(fd) != 0) e(9);
	if (unlink("bar/nono") != 0) e(10);
  }

  /* Clean up bar. */
  System("rm -rf bar");

  /* Test ToLongName and ToLongPath */
  does_truncate = does_fs_truncate();
  fd = creat(ToLongName, 0777);
  if (does_truncate) {
	if (fd == -1) e(11);
	if (close(fd) != 0) e(12);
  } else {
	if (fd != -1) e(13);
	if (errno != ENAMETOOLONG) e(14);
	(void) close(fd);			/* Just in case. */
  }

  ToLongPath[PATH_MAX - 2] = '/';
  ToLongPath[PATH_MAX - 1] = 'a';
  if ((fd = creat(ToLongPath, 0777)) != -1) e(15);
  if (errno != ENAMETOOLONG) e(16);
  if (close(fd) != -1) e(17);
  ToLongPath[PATH_MAX - 1] = '/';
}
开发者ID:AgamAgarwal,项目名称:minix,代码行数:55,代码来源:test30.c

示例9: main

int main() {
  int status;
  if ((status = System("date")) < 0) err_sys("System error");
  pr_exit(status);

  if ((status = System("nosuchcommond")) < 0) err_sys("System error");
  pr_exit(status);

  if ((status = System("who; exit 44")) < 0) err_sys("System error");
  pr_exit(status);
}
开发者ID:mahaicheng,项目名称:unix-program,代码行数:11,代码来源:8-23.c

示例10: init

void init()
{
    Handle<es::Context> root = System()->getRoot();
    framebuffer = root->lookup("device/framebuffer");
    long long size;
    size = framebuffer->getSize();
    framebufferPtr = (u8*) System()->map(0, size,
                                 es::CurrentProcess::PROT_READ | es::CurrentProcess::PROT_WRITE,
                                 es::CurrentProcess::MAP_SHARED,
                                 framebuffer, 0);
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:11,代码来源:fontconfig.cpp

示例11: System

void CLogArchiver::DoArchive(bool bDispErr)
{
	uint32 nOldArchId = m_nArchId;
	++m_nArchId;
	if(m_nArchId > m_nArchNo)
		m_nArchId = 1;
	char sLogDir[FOCP_MAX_PATH];
	CFormatString oCmd;
	CString::StringCopy(sLogDir, m_oLogDir.GetStr());
	CDiskFileSystem::GetInstance()->GetOsPathName(sLogDir);
#ifdef WINDOWS
	oCmd.Print("tar -czf %s\\%s.%03d.log.tar.gz %s\\%s.*.log 1>1.txt 2>2.txt", m_oArchDir.GetStr(), m_oLogName.GetStr(), m_nArchId, sLogDir, m_oLogName.GetStr());
#else
	oCmd.Print("tar -czf %s/%s.%03d.log.tar.gz %s/%s.*.log 1>1.txt 2>2.txt", m_oArchDir.GetStr(), m_oLogName.GetStr(), m_nArchId, sLogDir, m_oLogName.GetStr());
#endif
	int32 nRet = System(oCmd.GetStr());
	char sErrFile[FOCP_MAX_PATH];
	CString::StringCopy(sErrFile, "disk://");
	CDiskFileSystem::GetInstance()->GetFullPath("2.txt", sErrFile+7);
	CFile oFile(sErrFile, "r");
	bool bHaveError = false;
	CString oError;
	while(true)
	{
		int32 nLen = oFile.Read(sErrFile, FOCP_MAX_PATH);
		if(nLen <= 0)
			break;
		bHaveError = true;
		oError.Append(sErrFile, nLen);
	}
	oFile.Redirect(NULL);
	if(bHaveError)
	{
		m_nArchId = nOldArchId;
		if(bDispErr)
			FocpError(("%s", oError.GetStr()));
	}
	else if(nRet)
	{
		m_nArchId = nOldArchId;
		if(bDispErr)
			FocpError(("system('%s') failure", oCmd.GetStr()));
	}
	else
	{
		oCmd.Clear();
		oCmd.Print("rm -rf %s\\%s.*.log 1>1.txt 2>2.txt", sLogDir, m_oLogName.GetStr());
		System(oCmd.GetStr());
	}
	System("rm -rf 1.txt");
	System("rm -rf 2.txt");
}
开发者ID:nightstyles,项目名称:focp,代码行数:52,代码来源:LogArchiver.cpp

示例12: XeresCalibMain_main

int XeresCalibMain_main(int argc,char** argv)
{
   MMD_InitArgcArgv(argc,argv);

   std::string aSeq,aDir,OutCal="Calib";
   int aSz=1500;



   ElInitArgMain
   (
         argc,argv,
         LArgMain()  //  << EAMC(aSeq, "Sequence")
                     << EAMC(aDir, "Directory"),
         LArgMain()  << EAM(aSeq,"Seq",true,"Folder of data, Def=./")
                     << EAM(aSz,"Sz",true,"Sz of TieP, Def=1500")
                     << EAM(OutCal,"Out",true,"")
   );

   // std::string aCdDir = "cd " + aDir + "/";
   // System(aCdDir);
   if (!EAMIsInit(&aSeq) ) aSeq = aDir;

   cElemAppliSetFile anEASF(aDir+"/.*jpg");

   const std::vector<std::string> * aVS = anEASF.SetIm();
   int aNbIm = aVS->size();
   for (int aK=0 ; aK<aNbIm ; aK++)
   {
        const std::string & aName = (*aVS)[aK];
        ELISE_fp::MvFile(aDir+"/"+aName,aDir+"/"+aSeq+"_Calib" +ToString(aK) + ".jpg");
        std::cout << "NAME = " << aName << "\n";
   }

   std::string aStrMMD= "MicMac-LocalChantierDescripteur.xml";

   ELISE_fp::CpFile(aStrMMD,aDir+"/"+aStrMMD);


   std::string aComTiep = MM3dBinFile_quotes("Tapioca") + " All  " + aDir + "/.*jpg " + ToString(aSz);
   System(aComTiep);

   std::string aComOri =  MM3dBinFile_quotes("Tapas ") + " FraserBasic " +  aDir + "/.*jpg " + " Out=" + OutCal
                          + " RankInitPP=0 RankInitF=1 RefineAll=0";
   System(aComOri);


   return EXIT_SUCCESS;
}
开发者ID:archeos,项目名称:micmac-archeos,代码行数:49,代码来源:Exeres.cpp

示例13: start

void* start(void* param)
{
    Check check;

    esReport("start(): %x %x %x\n", testA, testB, &testA);
    testA = 4;
    testB = 5;
    esReport("start(): %x %x %x\n", testA, testB, &testA);

    pthread_key_t key;
    pthread_key_create(&key, dtor);
    pthread_setspecific(key, (void*) 0x1234);

    esReport("m->lock();\n");
    m->lock();
    esReport("m->wait();\n");
    m->wait();
    esReport("m->unlock();\n");
    m->unlock();

#if 1
    esReport("Let's unwind.\n");
    es::CurrentThread* current(System()->currentThread());
    current->exit(0);

    esPanic(__FILE__, __LINE__, "Ooooops\n");
#endif
    return 0;   // lint
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:29,代码来源:main.cpp

示例14: sbcl_bin_install

int sbcl_bin_install(struct install_options* param) {
  int ret;
  char* home=configdir();
  char* impl=param->impl;
  char* version=param->version;
  char* impl_path= cat(home,impldir(param->arch,param->os,impl,version),NULL);
  char* src=param->expand_path;
  char* sbcl_home=cat(impl_path,"/lib/sbcl",NULL);
  char* install_root=q(impl_path);
  char* log_path=cat(home,"impls/log/",impl,"-",version,"/install.log",NULL);
  cond_printf(0,"Building %s/%s...",impl,version);
  ensure_directories_exist(impl_path);
  ensure_directories_exist(log_path);
  change_directory(src);
  setenv("SBCL_HOME",sbcl_home,1);
  setenv("INSTALL_ROOT",install_root,1);
  ret=System("(cat find-gnumake.sh; echo find_gnumake)|sh");
  if(ret!=0) {
    fprintf(stderr,"'make' command not available.\n");
    return 0;
  }
  ret=1;
  if(system_redirect("sh install.sh",log_path)==-1)
    ret=0;
  s(home),s(impl_path),s(sbcl_home),s(install_root),s(log_path);
  printf(" Done.\n");
  return ret;
}
开发者ID:roswell,项目名称:roswell,代码行数:28,代码来源:install-sbcl-bin.c

示例15: launchMake

bool launchMake( const string &i_makefile, const string &i_rule, unsigned int i_nbJobs, const string &i_options, bool i_stopCurrentProgramOnFail )
{
	#ifdef __TRACE_SYSTEM__
		static int iMakefile = 0;
		string makefileCopyName;
		// look for a filename that is not already used
		do{
			if ( iMakefile>999 ) cerr << "WARNING: there is a lot of makefile copies already" << endl;
			stringstream ss;
			ss << "Makefile" << setw(3) << setfill('0') << iMakefile++;
			makefileCopyName = ss.str();
		}
		while ( ELISE_fp::exist_file( makefileCopyName ) );
		cout << "###copying [" << i_makefile << "] to [" << makefileCopyName << "]" << endl;
		ELISE_fp::copy_file( i_makefile, makefileCopyName, true );
		i_nbJobs = __TRACE_SYSTEM__; // no multithreading in trace_system mode
	#endif

	string nbJobsStr( "-j" );
	if ( i_nbJobs!=0 )
	{	
		stringstream ss;
		ss << i_nbJobs;
		nbJobsStr.append( ss.str() );
	}
	std::string aCom = string("\"")+(g_externalToolHandler.get( "make" ).callName())+"\" " + i_rule + " -f \"" + i_makefile + "\" " + nbJobsStr + " " + i_options;
	return ( System(aCom,!i_stopCurrentProgramOnFail)==EXIT_SUCCESS );
}
开发者ID:xialang2012,项目名称:micmac-archeos,代码行数:28,代码来源:cGPAO.cpp


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