本文整理汇总了C++中WString::truncate方法的典型用法代码示例。如果您正苦于以下问题:C++ WString::truncate方法的具体用法?C++ WString::truncate怎么用?C++ WString::truncate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WString
的用法示例。
在下文中一共展示了WString::truncate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runCmd
void VMsgLog::runCmd( WString &cmd )
{
static char buff[MAX_BUFF+1];
addLine( cmd );
blength = 0;
buffer[blength] = '\0';
if( !_batserv ) {
#ifdef __WINDOWS__
VxDPut( cmd.gets(), cmd.size() + 1 );
for(;;) {
int len = VxDGet( buff, MAX_BUFF );
buff[len] = '\0';
if( streq( buff, TERMINATE_COMMAND_STR ) ) {
break;
} else if( len > 0 ) {
scanLine( buff, len );
}
}
#endif
} else {
unsigned maxlen;
maxlen = BatchMaxCmdLine();
cmd.truncate( maxlen );
BatchSpawn( cmd );
for( ;; ) {
WSystemService::sysYield(); //allow other tasks to run
unsigned long stat;
int len = BatchCollect( buff, MAX_BUFF, &stat );
if( len < 0 ) {
break;
} else if( len > 0 ) {
scanLine( buff, len );
}
}
}
if( strlen( buffer ) > 0 ) {
addLine( buffer );
}
}
示例2: executeOne
bool VpeMain::executeOne( const WString& cmd )
{
int i = 0;
WWindowState wstate = WWinStateShowNormal;
WWindowType wtype = WWinTypeDefault;
if( strnicmp( cmd, "!FullScreen ", 12 ) == 0 ) {
i += 12;
wtype = WWinTypeFullScreen;
} else if( strnicmp( cmd, "!Windowed ", 10 ) == 0 ) {
i += 10;
wtype = WWinTypeWindowed;
} else if( strnicmp( cmd, "!Hidden ", 8 ) == 0 ) {
i += 10;
wstate = WWinStateHide;
}
int ret = WSystemService::sysExec( &cmd[i], wstate, wtype );
stopWait();
#ifdef __OS2__
if( ret == -1 ) {
// this is a kludge because the WMessageDialog can only handle
// finitely long strings
WString cmdmsg;
cmdmsg = cmd;
cmdmsg.truncate( MAX_CMD_LINE );
//
// WARNING - this may stop working if WCLASS modifies errno
//
WMessageDialog::messagef( this, MsgError, MsgOk, _viperError,
"Unable to run %s: %s.",
(const char*)cmdmsg, strerror( errno ) );
return( false );
}
#endif
#if defined( __WINDOWS__ ) || defined ( __NT__ )
if( ret <= 32 ) {
// this is a kludge because the WMessageDialog can only handle
// finitely long strings
WString cmdmsg;
cmdmsg = cmd;
cmdmsg.truncate( MAX_CMD_LINE );
switch( ret ) {
case 0:
WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "%s: Out of memory.", (const char*)cmdmsg );
break;
case 2:
WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "%s: Program or one of its components not found.", (const char*)cmdmsg );
break;
case 3:
WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "%s: Path not found.", (const char*)cmdmsg );
break;
case 16:
WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "%s: Contains multiple writeable data segments.", (const char*)cmdmsg );
break;
default:
WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "%s: return code=%d.", (const char*)cmdmsg, ret );
}
return( false );
}
#endif
return( true );
}