473,748 Members | 5,242 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem in using system() functiions

60 New Member
hi everybody...
I've a problem in using system() functions.
my program was:
Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3.   clrscr()
  4.   system("dir");
  5.   getch();
  6. }
  7.  
but i got only a blank screen as output when run this code.
What is the problem in this?
Mar 31 '07 #1
6 1655
JosAH
11,448 Recognized Expert MVP
hi everybody...
I've a problem in using system() functions.
my program was:
Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3.   clrscr()
  4.   system("dir");
  5.   getch();
  6. }
  7.  
but i got only a blank screen as output when run this code.
What is the problem in this?
The system function can only start executable binaries (and maybe .bat files,
I'm not sure about that). It certainly can't start commands that are internal to
your shell (cmd.exe), i.e "dir" is not an executable command. Start the shell
(cmd.exe) itself as: "cmd /c dir".

kind regards,

Jos
Mar 31 '07 #2
horace1
1,510 Recognized Expert Top Contributor
hi everybody...
I've a problem in using system() functions.
my program was:
Expand|Select|Wrap|Line Numbers
  1. int main()
  2. {
  3.   clrscr()
  4.   system("dir");
  5.   getch();
  6. }
  7.  
but i got only a blank screen as output when run this code.
What is the problem in this?
this works OK for me using GNU C and Turbo C V3.0 under windows XP

what compiler/operating system are you using?
Mar 31 '07 #3
palani12kumar
60 New Member
Currently im using TurboC (that is in a LAN connection under Novel network)
Apr 2 '07 #4
Ganon11
3,652 Recognized Expert Specialist
Make sure you add a return 0; statement at the end of your program.
Apr 2 '07 #5
palani12kumar
60 New Member
I even tried that too....
Not only dir command, it seems that it was not working with any of the dos commands.... I dont know waht to do
Apr 2 '07 #6
cjbrx3115
93 New Member
I even tried that too....
Not only dir command, it seems that it was not working with any of the dos commands.... I dont know waht to do
Did you try using the #include<window s.h>? And also, you don't have anything that would display as an output, try using some text as an output to see if that is your problem.
Apr 2 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

9
2255
by: Sudesh Sawant | last post by:
Hello, We have an application which communicates using remoting. There is a server which is a Windows Service. The server exposes an object which is a singleton. The client is a Web Application which makes calls to the service. We are using tcp channel which is using binaryformatter by default. The problem is that after a certain number of remoting calls the calls dont get through to the server. The client application makes the call and...
1
4025
by: Rhy Mednick | last post by:
I'm creating a custom control (inherited from UserControl) that is displayed by other controls on the form. I would like for the control to disappear when the user clicks outside my control the same way a menu does. To do this my control needs to get notified when the user tried to click off of it. The Leave and LostFocus events of the UserControl work most of the time but not always. For example, if they click on a part of the form...
1
2523
by: Joe Bloggs | last post by:
I am trying display the contents of a table in a web page, select certain rows from that table and then display the fields that I have selected (now table columns) as text in a Label object. Amazingly I have managed to display the table - no problem, I can select rows - no problem, BUT I can't work out how to display more than one of the fields (now columns in the table in the web page). I can display one field OK, but not more than one...
3
5616
by: James Spibey | last post by:
Hi, I have an MDI application which has aboout 10 child windows. The way the app needs to work is that only one window should be visible at a time and it should be maximized within the parent window. I have set all my child windows to be WindowState.Maximized but after showing 2 or 3 windows, the windows all drop back to Normal state. I have tried various things to overcome this inclusing overriding OnResize etc but none seem to give...
9
2822
by: Rajat Tandon | last post by:
Hello there, I am relatively new to the newsgroups and C#. I have never been disappointed with the groups and always got the prompt replies to my queries.This is yet another strange issue, I am facing. Please please help me to solve this as soon as possible. So here we go ... I am not able to take the screen shot of the windows form based "Smart
0
1893
by: 42 | last post by:
I implemented a simple class inherited from Page to create a page template. It simply wraps some trivial html around the inherited page, and puts the inherited page into a form. The problem I have run into is that the emitted html at the end of the process is slightly different and doesn't work. Please don't be put off by all the source code. All the guts are in this first base class, and it doesn't do much. The rest is trivial...
0
1560
by: michael | last post by:
Hi. I have a problem using the CollectioEditor. In my custom control I have a public property that returns ItemList. ItemList is inherited from CollectionBase and contains very simple items called "TestItem" that are inherited from Control. i have added,To the TestItem class, a proprety called "ItemIcon", and I added to this property the attribute Editor(typeof(ImageUrlEditor)....). In design-time, I can access the "ItemList" property...
8
9759
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my problem: my vb.net program has problems with UNC. If the UNC server is restarted or goes off-line, my VB.net program crashes. The code for UNC access to the file is included below and is put in the tick event of a form timer control running every...
5
2005
by: Vibhesh | last post by:
I am facing problem with TimeSpan structure when DirectX is used. Following is the sample code that causes the problem: *************************************************************************************************************** { ........................... PrintTimeSpanProblem(); device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, presentParams); PrintTimeSpanProblem();
0
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9534
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9366
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6793
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.