Running dos command through c++

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 21
Reputation: scholar is an unknown quantity at this point 
Solved Threads: 0
scholar scholar is offline Offline
Newbie Poster

Running dos command through c++

 
0
  #1
Sep 24th, 2008
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

  1. #include<process.h>
  2. void main()
  3. {
  4. system("c:\\windows\\system32\\Notepad");
  5. }
I even tried wid 'system("notepad")' but even tht didn't run the command.Plz tell me if i am going wrong anywhere...
Last edited by Narue; Sep 24th, 2008 at 4:32 pm. Reason: added code tags and formatting
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,813
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: Running dos command through c++

 
0
  #2
Sep 24th, 2008
Originally Posted by scholar View Post
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<process.h>
void main()
{
system("c:\\windows\\system32\\Notepad");
}

I even tried wid 'system("notepad")' but even tht didn't run the command.Plz tell me if i am going wrong anywhere...
16 bit compiler? DOS command? What operating system does your computer use? If your computer is running a modern Operating System and there's no need to use DOS and a 16 bit compiler, I'd ditch them and get a more recent one.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,358
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1464
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Running dos command through c++

 
0
  #3
Sep 24th, 2008
You can't call any MS-Windows programs (such as Notepad.exe) from a 16-bit compiler because the compiler doesn't know how to do that.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC