-3

What I want to do is create a program to prompt the user for input. If they select yes I want to terminate the rest of the program. If they select no I want to immediately run a script. If there is no input for 5 minutes I want the script to automatically run. The only reason I want to use the script or batch file is I previously created it and it is already done.

The problems I am having is I am not sure how to declare the file system and file so it can be called. Then, I am not sure how to call the script to run. I am also not sure how to count down the 5 minutes to auto launch the script when ready. Below is my file in all it's current form.

//Program Name Apex Database Backup
//Written 8/3/2016
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <string>
#include <windows.h>
#include <stdio.h>
using namespace std;
int main()
{
    //Declarations
    bool yes;
    bool no;
    char yesOrno;
    string open;
    FILE *C$;
    //Prompt the User for Input
    cout << "Are You Currently Loading Out? If Not This Program Will Execute in 5 Minutes. " << endl;
    cout << "You Will Lose Your Connection to Apex! " << endl;
    cout << "Enter yes or no: " << endl;
    //Get User Input
    cin >> yesOrno;
    //Open the File
    public FILE *DatabaseBackup.bat fopen(*C$)
        //Process the Selection
            if (no)
            {
                ShellExecute (DatabaseBackup.bat);
            }   

    return 0;
}
Fantastic Mr Fox
  • 32,495
  • 27
  • 95
  • 175

1 Answers1

0

The problems I am having is I am not sure how to declare the file system and file so it can be called.

I'm not sure what you mean by "declare the file system". If you want to open a file, take a look at C++ File IO

Then, I am not sure how to call the script to run

Running the script is a OS related function. See this answer on how to do this.

I am also not sure how to count down the 5 minutes to auto launch the script when ready.

You need to use a timer/clock with a signal/interrupt.

Community
  • 1
  • 1
pfx7
  • 1