Starting another Windows .exe with C++Code//Deleting a File

I use Visual C++ 6.0.
I've got two problems.
First I want to start an Exe File when klicking a Button in my Application. What do I have to write into the BnClicked Funktion?

Second I want to delete a Text file, which I have accessed with:

ifstream fin("info");
char str(80);
int i;
fin>>str>>i;
MessageBox(str+" "+i);
fin.close();

So after reading the Data out of the File, I want to delete it. What is the easiest way to do this.


PS.: Please keep it simple since I'm a Newbie in C++ programming and the programm mustn't be absolut professional.

Comments

  • : I use Visual C++ 6.0.
    : I've got two problems.
    : First I want to start an Exe File when klicking a Button in my Application. What do I have to write into the BnClicked Funktion?
    :
    [blue]In the resource editor, just double-click the button. ClassWizzard will create a function for you.[/blue]

    : Second I want to delete a Text file, which I have accessed with:
    :
    : ifstream fin("info");
    : char str(80);
    : int i;
    : fin>>str>>i;
    : MessageBox(str+" "+i);
    : fin.close();
    :
    : So after reading the Data out of the File, I want to delete it. What is the easiest way to do this.
    :
    :
    : PS.: Please keep it simple since I'm a Newbie in C++ programming and the programm mustn't be absolut professional.
    :
    [code]
    remove("filename");
    [/code]

  • : : I use Visual C++ 6.0.
    : : I've got two problems.
    : : First I want to start an Exe File when klicking a Button in my Application. What do I have to write into the BnClicked Funktion?
    : :
    : [blue]In the resource editor, just double-click the button. ClassWizzard will create a function for you.[/blue]
    :
    : : Second I want to delete a Text file, which I have accessed with:
    : :
    : : ifstream fin("info");
    : : char str(80);
    : : int i;
    : : fin>>str>>i;
    : : MessageBox(str+" "+i);
    : : fin.close();
    : :
    : : So after reading the Data out of the File, I want to delete it. What is the easiest way to do this.
    : :
    : :
    : : PS.: Please keep it simple since I'm a Newbie in C++ programming and the programm mustn't be absolut professional.
    : :
    : [code]
    : remove("filename");
    : [/code]
    :
    :

    also for the line
    char str(80);
    it should be restated to
    char str[80];
    or
    char *str = new char[80];
    seing that an arry is defined by [] brackets
    TFKyle

  • [b][red]This message was edited by Jun_Misugi at 2003-7-6 4:16:21[/red][/b][hr]
    : [blue]In the resource editor, just double-click the button. ClassWizzard will create a function for you.[/blue]
    : [code]
    : remove("filename");
    : [/code]
    First: I think I made my self missunderstood. I actually have this function you described, but with this function I want to start another .Exe outside my Programm.
    [code]
    void Admin::OnInsertMember()
    {
    //Starting "Login.exe" here
    }
    [/code]
    And now I need some code to start this Login.exe.

    Second: Thanks, that's what I wanted.

    @TFKey: Thanks, typing error which I have already corrected in my code.
  • : First: I think I made my self missunderstood. I actually have this function you described, but with this function I want to start another .Exe outside my Programm.
    : [code]
    : void Admin::OnInsertMember()
    : {
    : //Starting "Login.exe" here
    : }
    : [/code]
    : And now I need some code to start this Login.exe.
    :

    [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
  • : [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
    :
    Thats what I wanted. Thx.
  • : : [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
    : :
    : Thats what I wanted. Thx.
    :

    What about ShellExecute? Or is that just VB (Cause I am a VB programmer... learning C++ MFC!)

    Greets...
    Richard

  • : : : [blue]use either CreateProcess() or WinExec() or system() functions.[/blue]
    : : :
    : : Thats what I wanted. Thx.
    : :
    :
    : What about ShellExecute? Or is that just VB (Cause I am a VB programmer... learning C++ MFC!)
    :
    : Greets...
    : Richard
    :
    :

    yup! look it up at www.msdn.microsoft.com to find out how to use it.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories