Help needed regarding System() in C

vikky1988i's Avatar, Join Date: Apr 2010
Go4Expert Member
Hello ,
Good evening all .

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 , I have tried searching in NET , but it failed.
xpi0t0s's Avatar, Join Date: Aug 2004
Mentor
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.
vikky1988i's Avatar, Join Date: Apr 2010
Go4Expert Member
Thanks alot , i got ur's