Inserting Numbers into a command Code: cout << "Shutdown:\n"; //cin >> seconds; system("shutdown -s -f -t"); //I want to place the seconds right after -t How would I input seconds into my system command?
Well you could do [Highlight=cpp] int iSeconds; cin >> iSeconds; Sleep(iSeconds*1000); //1000 Millisecond = 1 Second system("shutdown"); [/Highlight] Should work, Test for me
Thanks, but now how would I do it for this type of problem? Code: system("cls"); cout << "Run:\n"; string item; cin >> item; //OpenProcess()//This will be whatever they typed in item I want them to type the program they want to open. It will store it inside of item, then it will use it in OpenProcess
char shut[100]; int iTime = 6000; wsprintf(shut,"shutdown -s -f -t %d",iTime); system(shut); for the first problem... second problem i dont really get what u mean... (if its what i guess u can use the solution i gave u also for this)
Originally Posted by aanthonyz Thanks, but now how would I do it for this type of problem? Code: system("cls"); cout << "Run:\n"; string item; cin >> item; //OpenProcess()//This will be whatever they typed in item I want them to type the program they want to open. It will store it inside of item, then it will use it in OpenProcess I think you want to save what they type in then open up later? In that case, make it like: Code: char *xxxxx; void "w/e function is"(void){ char *xxxxx = (w/e they typed in here); OpenProcess(xxxxx); }