1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

Help needed regarding System() in C

Discussion in 'C' started by vikky1988i, Jun 16, 2011.

  1. vikky1988i

    vikky1988i New 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 :smug::smug: , I have tried searching in NET , but it failed.
  2. xpi0t0s

    xpi0t0s 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.
  3. vikky1988i

    vikky1988i New Member

    Thanks alot , i got ur's :)

Share This Page