|
From: Noorez K. <coo...@ho...> - 2004-02-13 18:15:14
|
Just for the fun of it i made this prompt thing but it doesn't switch
directories? Can you see how i can get it to do it?
#include <iostream>
#include <cstdlib>
using namespace std;
int system();
int main()
{
cout << "Easy to use dos-prompt!" << endl;
cout << "To switch dirves use this: drvswitch\n" << endl;
char ask;
do
{
cout << "Would you like to enter the system? [Y\\N]";
cin >> ask;
if(ask == 'y' || ask == 'Y')
{
system();
system("pause");
return 0;
}
else if(ask == 'n' || ask == 'N')
{
cout << "Bye!" << endl;
system("pause");
return 0;
}
else
{
cout << "What....\n" << endl;
}
}while(ask != 'y' || ask != 'Y' || ask != 'n' || ask != 'N');
return 0;
}
//define the system function
int system()
{
drvswitch:
cout << "What drive would you like to go to?";
char drv[8];
cin >> drv;
strcat(drv,":");
system(drv);
cout << "Now in drive " << drv << endl;
cout << "Type in commands: " << endl;
strcat(drv,"\\>");
char coms[123];
while(1)
{
cout << drv;
cin.getline(coms,124);
if(strcmp(coms,"exit")==0)
{
return 0;
}
if(strcmp(coms,"drvswitch")==0)
{
goto drvswitch;
}
system(coms);
cout << endl;
}//while
}
_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=dept/features&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
|