open a .txt with notepad [no console]

Apr 19, 2020 at 4:14pm
Hi, I'm wanting to open a .txt with notepad from my project, but I want to avoid using cmd.exe [I don't want a console window appearing]

Is that possible?
I've searched around but have only found ways that open with cmd

Apr 19, 2020 at 4:19pm
Hello lostdog,

You could try ShellExecute(NULL, "open", fileName.c_str(), NULL, NULL, SW_SHOWNORMAL);. I believe you will need the "windows.h" header file.

Andy
Apr 19, 2020 at 4:59pm
1
2
3
4
5
6
7
8
#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
   system( "notepad.exe myfile.txt" );
}
Apr 19, 2020 at 5:34pm
As @lastchance stated, you can use system() to open it. However, I would avoid using system() except for the most trivial projects.
Topic archived. No new replies allowed.