本文整理汇总了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);
}