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


C++ PathName::GetLength方法代码示例

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


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

示例1: outFileTemplate

void
dvipdft (/*[in]*/ int		argc,
	 /*[in]*/ const char **	argv)
{
  // must have at least one argument: the DVI file name
  if (argc == 1)
    {
      BadUsage ();
    }

  char szGSExePath[BufferSizes::MaxPath];
  SessionWrapper(true)->GetGhostscript (szGSExePath, 0);

  PathName dvipdfmExe;
  if (! SessionWrapper(true)->FindFile("dvipdfm",
				       FileType::EXE,
				       dvipdfmExe))
    {
      FatalError (MIKTEXTEXT("The Dvipdfm executable could not be found."));
    }

  // create a temporary directory
  TempDirectory tempDir;

  CommandLineBuilder arguments;
  PathName fileNoExt;

  // loop over all arguments except the last one
  for (int i = 1; i < argc - 1; ++ i)
    {
      arguments.AppendArgument (argv[i]);
      if (strcmp(argv[i], "-o") == 0 && i + 1 < argc - 1)
	{
	  ++ i;
	  arguments.AppendArgument (argv[i]);
	  fileNoExt = argv[i];
	  fileNoExt.SetExtension (0);
	}
    }

  const char * lpszUserFilename = argv[argc - 1];
  if (fileNoExt.GetLength() == 0)
    {
      fileNoExt = lpszUserFilename;
      fileNoExt.SetExtension (0);
    }

  // run dvipdfm with the fastest options for the first pass
  arguments.AppendOption ("-e");
  arguments.AppendOption ("-z", "0");
  arguments.AppendArgument (lpszUserFilename);
  int exitCode = 0;
  if (! Process::Run(dvipdfmExe.Get(), arguments.Get(), 0, &exitCode, 0))
    {
      FatalError (MIKTEXTEXT("%s could not be started."), dvipdfmExe.Get());
    }
  if (exitCode != 0)
    {
      throw (exitCode);
    }

  // run GhostScript to create thumbnails
  PathName outFileTemplate (tempDir.Get(), fileNoExt.Get(), "%d");
  arguments.Clear ();
  arguments.AppendOption ("-r", "10");
  arguments.AppendOption ("-dNOPAUSE");
  arguments.AppendOption ("-dBATCH");
  arguments.AppendOption ("-sDEVICE:", "png256");
  arguments.AppendOption ("-sOutputFile:", outFileTemplate.Get());
  arguments.AppendArgument (PathName(0, fileNoExt.Get(), ".pdf").Get());
  if (! Process::Run(szGSExePath, arguments.Get(), 0, &exitCode, 0))
    {
      FatalError (MIKTEXTEXT("%s could not be started."), szGSExePath);
    }
  if (exitCode != 0)
    {
      throw (exitCode);
    }

  // run dvipdfm with the users specified options for the last pass
  arguments.Clear ();
  arguments.AppendOption ("-dt");
  arguments.AppendArguments (argc - 1, &argv[1]);
  printf ("dvipdfm %s\n", arguments.Get());
  Utils::SetEnvironmentString ("MIKTEX_TEMP", tempDir.Get());
  if (! Process::Run(dvipdfmExe.Get(), arguments.Get(), 0, &exitCode, 0))
    {
      FatalError (MIKTEXTEXT("%s could not be started."), dvipdfmExe.Get());
    }
  if (exitCode != 0)
    {
      throw (exitCode);
    }

  tempDir.Delete ();
}
开发者ID:bngabonziza,项目名称:miktex,代码行数:96,代码来源:dvipdft.cpp


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