I have a query , how to open notepad files already saved in the memory...... or PPT or Docs. Though system() is there in C , but it invokes .EXE files only ..

(.i.e) if i have a notepad named : SRV.txt.. how to open it using System() which opens a Notepad window to SRV.txt????

Please help :smug::smug: , I have tried searching in NET , but it failed.

xpi0t0s

17Jun2011 15:33

Re: Help needed regarding System() in C

Two solutions.
(1) you can call system("notepad.exe srv.txt"); which should do the trick (you may need to add paths into that).
(2) (I think) you can use one of the WinExec functions to invoke srv.txt, which will look up what application is associated with srv.txt and launch it with srv.txt as the first parameter.

system("srv.txt") definitely won't work though. As you correctly observe, system() is for executables only.