Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Help needed regarding System() in C (http://www.go4expert.com/forums/help-regarding-c-t26073/)

vikky1988i 16Jun2011 16:01

Help needed regarding System() in C
 
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 :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.

vikky1988i 17Jun2011 16:25

Re: Help needed regarding System() in C
 
Thanks alot , i got ur's :)


All times are GMT +5.5. The time now is 08:08.