open a .txt with notepad [no console]

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

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
1
2
3
4
5
6
7
8
#include <iostream>
#include <cstdlib>
using namespace std;

int main()
{
   system( "notepad.exe myfile.txt" );
}
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.