This probably belongs in a separate thread (and for the 15 months or so I've been a member here, it's been asked about 20-50 times).
In Windows, you'd use "ShellExecute" - look that up on msdn.microsoft.com
--
Mats
Printable View
all i get is an empty console screen... can anybody help me with the shellexecute codes, i just want to open a text file.Code:#include "windows.h"
#include "iostream.h"
int main()
{
char input;
cin.get(input);
ShellExecute(NULL, "open", "hello.txt", "input", "C:\Documents and Settings\Administrator\Desktop\Alpha\hello.txt", SW_HIDE);
return 0;
}
According to MSDN:
4. If parameter 3 is a file, parameter 4 must be NULL.
5. This is the working directory. "C:\Documents and Settings\etcetera\hello.txt" is not a directory, it is a file. Also, backslashes need to be escaped, like "C:\\Documents and Settings\\etcetera", which is why you're getting all those warnings about nonsense escape characters.
6. SW_HIDE says to immediately hide the notepad window.