Solved

How can i execute the system command from 'C' programme

Posted on 2000-03-19
2
230 Views
Last Modified: 2010-04-15
How to run system command from 'C' prgramme. When i use 'System(command)'
in the programme, it is getting  executed but DOS screen flashes momentarily and control comes to programme. How to execute the same in
back ground without DOS screen flashing.
0
Comment
Question by:tarigopula
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 32

Accepted Solution

by:
jhance earned 50 total points
ID: 2633428
When you call the system() is does the following (excerpted from the system doc page in the SDK):

"The system function passes command to the command interpreter, which executes the string as an operating-system command"

The command interpreter, (either COMMAND.COM on Win9x or CMD.EXE on NT) get run and it starts the command you give it.  If you don't want the flash of the command interpreter window, don't call system().

Use one of the other methods of starting your program.  Most likely you should be using CreateProcess() or ShellExecuteEx().  Either will start a new program without any command interpreter and hence, no flashing.
0
 
LVL 1

Expert Comment

by:ntdragon
ID: 2633431
i don't know 'cause you are runing a dos commands so a dos shell should be opened and if your program opened a window it will be in it<> it won't open another window>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question