Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.
C++ multiusing of command
hi, so i have my little "virtual console" almost completed, who read my thread C++ "condition in condition" knows about it. i need little help with this problem:
{
reboot = false;
cout << "File was successfully deleted\n";
cout << "\n";
goto commands;
}```
so when you type into console rm reboot, reboot boolean is set to false and you get File was successfully deleted, and when you type ls command, you dont see reboot file anymore. but.. if u type rm reboot again, you get again File was successfully deleted, but this files "does not exist" how can i fix it, when users type rm reboot, and reboot boolean is on "false", not on "true" he get file not found.
thanx in advance
dancuc wrote: hi, so i have my little "virtual console" almost completed, who read my thread C++ "condition in condition" knows about it. i need little help with this problem:
{
reboot = false;
cout << "File was successfully deleted\n";
cout << "\n";
goto commands;
}```
so when you type into console rm reboot, reboot boolean is set to false and you get File was successfully deleted, and when you type ls command, you dont see reboot file anymore. but.. if u type rm reboot again, you get again File was successfully deleted, but this files "does not exist" how can i fix it, when users type rm reboot, and reboot boolean is on "false", not on "true" he get file not found.
thanx in advance
with another if/else statement on reboot.
If reboot is true, execute the lines otherwise don't.
ok so i have this:
{
if ( command == "rm reboot" )
{
reboot = false;
cout << "File was Successfully deleted\n";
cout << "\n";
goto commands;
}
if (command.substr(0,2) == "rm")
{
cout << "File could not be found in: /sbin\n";
cout << "\n";
goto commands;
}
}
else
{
cout << "ERROR: File does not exist\n";
cout << "\n";
}
else
{
cout << "Command not recognized\n";
cout << "\n";
goto commands;
}
}```
but it doesn´t work i dont know why what is wrong?
EDIT: smileys disabled