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


C++ OString::rightCut方法代码示例

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


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

示例1: backup

void GTPMWin::backup()
{
#ifdef __TK21__
 PSZ   tempEnv;
#else
 PCSZ  tempEnv;
#endif 
 PSZ      pstr;
 ULONG    item, items;
 OString  path;
 OString  includes;
 OString  excludes;
 OString  batch;
 OString  dirfile;
 OString  str;
 ofstream incfile;
 ofstream excfile;
 ofstream batchfile;
 
 if ((DosScanEnv("TEMP", &tempEnv)) &&
     (DosScanEnv("TMP", &tempEnv)))
  {
   path << GTPMApp::GTakPM->callName;
   path.rightCut('\\');
  }
 else
   path << (PSZ)tempEnv;

 if (path.getText()[strlen(path) - 1] != '\\')
   path + "\\";

 includes << path;
 includes + "gtmp.inc";
 excludes << path;
 excludes + "gtmp.exc";
 batch << path;
 batch + "gtmp.cmd";
 dirfile << path;
 dirfile + "gtmp.dir";

 path << "Cannot open: ";

 incfile.open(includes);
 if (!incfile) {
   path + includes;
   throw OPMException(path, 0); }

 excfile.open(excludes);
 if (!excfile) {
   path + excludes;
   throw OPMException(path, 0); }

 batchfile.open(batch);
 if (!batchfile) {
   path + batch;
   throw OPMException(path, 0); }

// write includes-file 
 items = Includes->queryItemCount();
 for(item = 0; item < items; item++)
   if (Includes->queryItemText(str, item)) {
     pstr = str.getText();
     while((pstr = strchr(pstr, '\\'))!=NULL)
       pstr[0] = '/';
     incfile << ((PSZ)(strchr(str, ' ')+1)) << endl; }
 incfile.close();

// write excludes-file 
 items = Excludes->queryItemCount();
 for(item = 0; item < items; item++)
   if (Excludes->queryItemText(str, item)) {
     pstr = str.getText();
     while((pstr = strchr(pstr, '\\'))!=NULL)
       pstr[0] = '/';
     excfile << ((PSZ)(strchr(str, ' ')+1)) << endl; }
 excfile.close();

// write batchfile
 batchfile << "@ECHO OFF\n"
           << "echo Initializing Tape\n"
           << "tape stat >NUL 2>NUL\n"
           << "tape blocksize 0 stat sel 0 eraseq tell\n"
           << "echo Backup in progress\ntar -cEppP @"
           << (PSZ) includes
           << " --totals --exclude-from "
           << (PSZ) excludes
           << " -D "
           << (PSZ) dirfile
           << "\ntape stat\n"
           << "echo Compare in progress\n"
           << "tape rew >NUL 2>NUL\n"
           << "tar -dEppP\n"
           << "tape stat\n"
           << "echo Operation completed.\n";
 batchfile.close();
 tape->batch(batch);
}
开发者ID:OS2World,项目名称:LIB-Cubus_OS2_Class_Library,代码行数:97,代码来源:Backup.cpp


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