本文整理汇总了C++中FileSystem::GetCWD方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSystem::GetCWD方法的具体用法?C++ FileSystem::GetCWD怎么用?C++ FileSystem::GetCWD使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSystem
的用法示例。
在下文中一共展示了FileSystem::GetCWD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void) {
//_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
FileSystem fs;
string userCommand, commandArr[MAXCOMMANDS];
string user = "[email protected]"; // Change this if you want another user to be displayed
string currentDir = "/"; // current directory, used for output
bool bRun = true;
fs.format();
//HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
do {
currentDir = fs.GetCWD();
string data = "";
//SetConsoleTextAttribute(hConsole, 10);
cout << user << " ";
//SetConsoleTextAttribute(hConsole, 14);
cout << currentDir << endl;
//SetConsoleTextAttribute(hConsole, 15);
cout << "$ ";
getline(cin, userCommand);
for (unsigned i = 0; i < MAXCOMMANDS; ++i)
commandArr[i] = "";
int nrOfCommands = parseCommandString(userCommand, commandArr);
if (nrOfCommands > 0) {
int cIndex = findCommand(commandArr[0]);
switch(cIndex) {
case 0: // quit
bRun = false;
cout << "Exiting\n";
break;
case 1: // format
fs.format();
break;
case 2: // ls
if (commandArr[1] == "")
fs.ls();
else
fs.ls(commandArr[1]);
break;
case 3: // create
printf("Please Insert Data:\n");
getline( cin, data );
fs.create(commandArr[1],data);
break;
case 4: // cat
fs.cat(commandArr[1]);
break;
case 5: // createImage
fs.createImage( commandArr[1] );
break;
case 6: // restoreImage
fs.restoreImage( commandArr[1] );
break;
case 7: // rm
fs.rm(commandArr[1]);
break;
case 8: // copy
fs.copy( commandArr[1], commandArr[2] );
break;
case 9: // append
fs.append( commandArr[1], commandArr[2] );
break;
case 10: // rename
fs.rename( commandArr[1], commandArr[2] );
break;
case 11: // mkdir
fs.mkdir(commandArr[1]);
break;
case 12: // cd
fs.cd(commandArr[1]);
break;
case 13: // pwd
cout << fs.GetCWD() << endl;
break;
case 14: // help
cout << help() << endl;
break;
case 15: // rmdir
fs.rmdir(commandArr[1]);
break;
case 16: // chmod
fs.chmod( atoi( commandArr[1].c_str() ), commandArr[2] );
break;
//.........这里部分代码省略.........