Run a dos command through c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Scholar
    New Member
    • Aug 2008
    • 9

    Run a dos command through c++

    Hi, I am using a 16-bit compliler and i wanted to execute a dos commmand through c++ using system() command.I wrote the following code but it didn't help


    #include<proces s.h>
    void main()
    {
    system("c:\\win dows\\system32\ \Notepad");
    }

    I even tried wid 'system("notepa d")' but even tht didn't run the command.Plz tell me if i am going wrong anywhere...
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    Doesn't work when running from IDE for me (because of ENOMEM) , but works when running 16-bit executable outside of ide from command line prompt.

    Comment

    • donbock
      Recognized Expert Top Contributor
      • Mar 2008
      • 2427

      #3
      Check the return code from system(). That could provide a clue to what's going wrong.

      Comment

      • Ganon11
        Recognized Expert Specialist
        • Oct 2006
        • 3651

        #4
        Try Notepad.exe instead of Notepad

        Comment

        Working...