473,396 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Are clrscr(); and system("cls"); same?

AmberJain
884 Expert 512MB
Hello,

What is the difference between -------->

1. clrscr(); // defined in various header files

2. system("cls"); //available in stdio.h in bloodshed dev c++

Well, if there are no differences, then can we use them interchangebly?

PLUS,

I saw a bit slower execution of program (I'm not sure about this fact) while execution of my code that contained system("cls"); than clrscr();. Does that implies that system("cls"); is slower in execution in clrscr();? If yes, what's the reason for it?

THANKS TO EVERYONE IN ADVANCE...........

=============
[AmbrNewlearner]
=============
Jun 8 '08 #1
9 27221
JosAH
11,448 Expert 8TB
The system() function fires up an entire shell or command line interpreter, whatever
is available on your system and passes its argument to it. That may take some
time to complete. I don't know what your clrscr() function does but it probably
calls some highly system dependent functionality.

kind regards,

Jos
Jun 8 '08 #2
AmberJain
884 Expert 512MB
The system() function fires up an entire shell or command line interpreter, whatever
is available on your system and passes its argument to it. That may take some
time to complete. I don't know what your clrscr() function does but it probably
calls some highly system dependent functionality.

kind regards,

Jos
Well, clrscr() simply clears the screen (similar to "cls" command for DOS).

One more question,

I have recently switched from Borland Turbo C++ 3.0 (IDE + compiler) to Bloodshed Dev c++ (IDE) PLUS gcc (compiler).
Now my question is as follows---->
Can I use the include (or header files) available with Turbo C++ 3.0 in C programming using [Bloodshed Dev C++] + [gcc] combination.

THANKS IN ADVANCE....

=============
[AmbrNewlearner]
=============
Jun 8 '08 #3
JosAH
11,448 Expert 8TB
Well, clrscr() simply clears the screen (similar to "cls" command for DOS).
Yes, but the question was (and is) *how* does it do it? I briefly explained how that
system("cls") managed to clear the screen on a Windows machine (it'll fail
horribly on a Linux machine without any precautions) but we still don't know
how the clrscr() function accomplishes it. So the problem is not *that* it does
what you want, the problem is *how* does it do it.

One more question,

I have recently switched from Borland Turbo C++ 3.0 (IDE + compiler) to Bloodshed Dev c++ (IDE) PLUS gcc (compiler).
Now my question is as follows---->
Can I use the include (or header files) available with Turbo C++ 3.0 in C programming using [Bloodshed Dev C++] + [gcc] combination.
No, because those header files might expose certain structures used by a
library of vendor X; a library of vendor Y might use entirely different structures.

kind regards,

Jos
Jun 8 '08 #4
AmberJain
884 Expert 512MB
THANKS JosAH.......

Yes, but the question was (and is) *how* does it do it? I briefly explained how that
system("cls") managed to clear the screen on a Windows machine (it'll fail
horribly on a Linux machine without any precautions) but we still don't know
how the clrscr() function accomplishes it. So the problem is not *that* it does
what you want, the problem is *how* does it do it.
If you find something about this in future, please tell me.
No, because those header files might expose certain structures used by a
library of vendor X; a library of vendor Y might use entirely different structures.

kind regards,

Jos
OK, THANKS again...

=================
[AMBRNEWLEARNER]
=================
Jun 8 '08 #5
oler1s
671 Expert 512MB
Can I use the include (or header files) available with Turbo C++ 3.0 in C programming using [Bloodshed Dev C++] + [gcc] combination.
The only thing you are guaranteed is the implementation of the standard library. So only expect the header files for the standard library. There might be compiler specific header files, but as the phrase suggests, these are compiler specific.
Jun 8 '08 #6
AmberJain
884 Expert 512MB
The only thing you are guaranteed is the implementation of the standard library. So only expect the header files for the standard library. There might be compiler specific header files, but as the phrase suggests, these are compiler specific.
Thanks oler1s..........

============
AmbrNewlearner
============
Jun 8 '08 #7
oler1s
671 Expert 512MB
(In response to Josah’s comment about not knowing how clrscr() works) If you find something about this in future, please tell me.
I think you fail to understand what Josah is saying. clrscr is not part of any open standard. We cannot know how it works because it is compiler proprietary.
Jun 8 '08 #8
AmberJain
884 Expert 512MB
I think you fail to understand what Josah is saying. clrscr is not part of any open standard. We cannot know how it works because it is compiler proprietary.
Yeah, I misinterpreted JosAH.
But I now understand your point.

Thanks JosAH and oler1s......

============
AmbrNewlearner
============
Jun 10 '08 #9
system("cls")works in the same way as clrscr(),but the former seems slower than the latter i strongly advice to use the better option(quicker one)
Oct 26 '10 #10

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

Similar topics

1
by: AHR | last post by:
Hi NG I am learning MFC but only use the command promt at the moment to run my C++ programs. My problem is that i cant use clrscr() even if i include <conio.h>. I get this error: ****
5
by: Binny V A | last post by:
Hello Everyone, I have been programming in C++ with borland compiler for a while now. But when I try to compile the same programs with other complilers like mingw, digital mars etc. there are...
2
by: lavender | last post by:
In C programming, izzit got this function 1. clrscr( ); ? what header file I should use? 2. <conio.h> I donnon C programming have this header file or not, which I know is in ...
1
by: bluesteel | last post by:
Hi guys. I have programmed in c and use clrscr() from conio.h. The problem was that, when i started programming under c++ i found that clrscr is nonexistant! Even if i include conio.h it will not...
10
by: playagain | last post by:
Why I can't use the clrscr(); and gotoxy(); in some compilers?
8
by: Michele 'xjp' | last post by:
Hi there, I am using a POSIX-compliant system, Cygwin on Windows. I need the features of conio.h's getch() and clrscr(), but I can't compile programs with #include <conio.h(since conio.h is NOT...
3
by: rahul1989 | last post by:
can we use clrscr() function without using conio.h header file
5
by: Abhishek170 | last post by:
hello everyone, i'm just a beginner in C language. just wanted to ask wich include will i have to use while using gotoxy and clrscr or is there any link/site where i check all the functions in all...
2
by: naughtysriram | last post by:
what are the equivalent library functions found in conio.h (turbo c++) for other gnu c++ variations.. i need functions like gotoxy(), clrscr(), getch()...etc. thanks in advance
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.