本文整理汇总了C++中Console::GetCommand方法的典型用法代码示例。如果您正苦于以下问题:C++ Console::GetCommand方法的具体用法?C++ Console::GetCommand怎么用?C++ Console::GetCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Console
的用法示例。
在下文中一共展示了Console::GetCommand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cmd_read
//! read command
void cmd_read() {
//! get pathname
char path[32];
DebugPrintf("\n\rex: \"file.txt\", \"a:\\file.txt\", \"a:\\folder\\file.txt\"\n\rFilename> ");
console.GetCommand(path, 30);
//! open file
FILE file = volOpenFile(path);
//! test for invalid file
if (file.flags == FS_INVALID) {
DebugPrintf("\n\rUnable to open file");
return;
}
//! cant display directories
if ((file.flags & FS_DIRECTORY) == FS_DIRECTORY) {
DebugPrintf("\n\rUnable to display contents of directory.");
return;
}
//! top line
DebugPrintf("\n\n\r-------[%s]-------\n\r", file.name);
//! display file contents
while (file.eof != 1) {
//! read cluster
unsigned char buf[512];
volReadFile(&file, buf, 512);
//! display file
for (int i = 0; i<512; i++)
DebugPutc(buf[i]);
//! wait for input to continue if not EOF
if (file.eof != 1) {
DebugPrintf("\n\r------[Press a key to continue]------");
console.GetChar();
DebugPrintf("\r"); //clear last line
}
}
//! done :)
DebugPrintf("\n\n\r--------[EOF]--------");
}
示例2: cmd_proc
// proc (process) command
void cmd_proc() {
int ret = 0;
char name[32];
DebugPrintf("\n\rProgram file: ");
console.GetCommand(name, 30);
Process* pProcess = ProcessManager::GetInstance()->CreateProcess(name, PROCESS_USER);
if (pProcess == 0)
{
DebugPrintf("\n\rError creating process");
}
else
ProcessManager::GetInstance()->ExecuteProcess(pProcess);
}