iri0021
iri0021

Reputation: 51

Running C++ program and Notepad

How to open a notepad in C++ then still continue using the c++ program even when the notepad is open? I tried system("filename.txt") But I can't continue using the c++ program unless I close the notepad file. is this possible?

Upvotes: 1

Views: 1684

Answers (2)

rrirower
rrirower

Reputation: 4590

As an alternative, you can use ShellExecute like this:

ShellExecute(NULL, "open", _T("notepad.exe"), NULL, NULL, SW_SHOWNORMAL);

Upvotes: 2

David Haim
David Haim

Reputation: 26486

You didn't write on what OS you're on but on windows you can use

system("start notepad.exe");

for example:

#include <iostream>

int main (void){

    system("start notepad.exe");
    std::string x;
    std::cin>>x;
    std::cout<<x;
    return 0;
}

the trick is the "start" command rather then just the filename

Upvotes: 0

Related Questions