Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 132,630 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,060 people online right now. Registration is fast and FREE... Join Now!




clrscr();

3 Pages V  1 2 3 >  
Reply to this topicStart new topic

clrscr();

eLliDKraM
post 26 Nov, 2005 - 06:50 PM
Post #1


Pepè Le Pewn

Group Icon
Joined: 13 Aug, 2005
Posts: 6,565



Thanked 2 times

Dream Kudos: 225
My Contributions


I've been seeing more and more clrscr();'s typed into programs and decided that it would be more efficient than just typing many /n's tongue.gif. However, whenever I type clrscr();, it will not build because it cannot find the function clrscr. How am I seeing it work with other programs where it does not work with mine?
User is offlineProfile CardPM

Go to the top of the page

jaredolympia
post 26 Nov, 2005 - 07:25 PM
Post #2


New D.I.C Head

Group Icon
Joined: 15 Oct, 2005
Posts: 29



Dream Kudos: 75
My Contributions


Are you trying to find a function that clears the screen? If you are, I ran into that problem a little while ago. This should do the trick if you're running the program in MSDOS (non-ansi code). The clrscr() function might be compiler specific. Either way, I really don't know why to be honest.

CODE
system("CLS");


The following site contains more DOS commands:
EasyDOS Command Index

Hope this helps!

Sincerely,
jaredolympia

This post has been edited by jaredolympia: 26 Nov, 2005 - 11:50 PM
User is offlineProfile CardPM

Go to the top of the page

eLliDKraM
post 26 Nov, 2005 - 07:55 PM
Post #3


Pepè Le Pewn

Group Icon
Joined: 13 Aug, 2005
Posts: 6,565



Thanked 2 times

Dream Kudos: 225
My Contributions


That does not seam to work either. For both clrscr and this, I am supposedly missing the prototype.
User is offlineProfile CardPM

Go to the top of the page

Mrafcho001
post 26 Nov, 2005 - 08:11 PM
Post #4


D.I.C Addict

Group Icon
Joined: 1 Nov, 2005
Posts: 753



Thanked 5 times

Dream Kudos: 120
My Contributions


Clearing The Screen

system("cls"); should work just fine
clrscr() is in conio.h
User is offlineProfile CardPM

Go to the top of the page

eLliDKraM
post 26 Nov, 2005 - 08:15 PM
Post #5


Pepè Le Pewn

Group Icon
Joined: 13 Aug, 2005
Posts: 6,565



Thanked 2 times

Dream Kudos: 225
My Contributions


Yeah I include conio.h. It doesn't work.

EDIT: Using Dev C++ and PellesC compilers.

This post has been edited by eLliDKraM: 26 Nov, 2005 - 08:16 PM
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 26 Nov, 2005 - 10:32 PM
Post #6


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,176



Thanked 33 times

Dream Kudos: 25
My Contributions


Here's a little hint...none of the functions you have specified are ANSI compliant. conio.h itself is not ANSI compliant. Non ANSI compliant code is only usable in some compilers or platforms. If you use it, your code is automatically not cross platform compliant.

I know there is a tendancy these days to learn code, and come up with habits that are specific to certain platforms/compilers...this is not acceptable as a professional developer.

N/M...I'll write an article about it. It's important.
User is offlineProfile CardPM

Go to the top of the page

jaredolympia
post 27 Nov, 2005 - 12:02 AM
Post #7


New D.I.C Head

Group Icon
Joined: 15 Oct, 2005
Posts: 29



Dream Kudos: 75
My Contributions


Using system("cls") works on Dev-C++. Perhaps you are using an outdated version. You can run the following code to check.

CODE
#include <stdio.h>

int main(void)
{
   puts("Hello");
   system("PAUSE");
   system("CLS");
   system("PAUSE");
   return 0;
}


This post has been edited by jaredolympia: 27 Nov, 2005 - 12:04 AM


Attached File(s)
Attached File  cls.zip ( 5.54k ) Number of downloads: 107
User is offlineProfile CardPM

Go to the top of the page

Wizzy
post 27 Nov, 2005 - 03:36 AM
Post #8


D.I.C Regular

Group Icon
Joined: 20 Nov, 2005
Posts: 408



Thanked 1 times

Dream Kudos: 145
My Contributions


These never used to exist for C++, it was C's source code.

Check your compiler environment while i test this,
User is offlineProfile CardPM

Go to the top of the page

microchip
post 27 Nov, 2005 - 04:16 AM
Post #9


New D.I.C Head

*
Joined: 14 Aug, 2005
Posts: 37



Thanked 3 times
My Contributions


But you can use C code in C++, so if you plan to use conio.h, there's nothing stopping you...

Just a thought, wouldn't sending a newpage ASCII code clear the screen?
User is offlineProfile CardPM

Go to the top of the page

Wizzy
post 27 Nov, 2005 - 04:31 AM
Post #10


D.I.C Regular

Group Icon
Joined: 20 Nov, 2005
Posts: 408



Thanked 1 times

Dream Kudos: 145
My Contributions


umm even if i use that program including either stdlib or stdio i get the msg:

QUOTE
ISO C++ does not support 'long long'


(using latest version)
User is offlineProfile CardPM

Go to the top of the page

microchip
post 27 Nov, 2005 - 05:45 AM
Post #11


New D.I.C Head

*
Joined: 14 Aug, 2005
Posts: 37



Thanked 3 times
My Contributions


Argh yeah, you're right about that. Maybe putting

extern "C" {
}

around the #include would help...
User is offlineProfile CardPM

Go to the top of the page

eLliDKraM
post 27 Nov, 2005 - 09:13 AM
Post #12


Pepè Le Pewn

Group Icon
Joined: 13 Aug, 2005
Posts: 6,565



Thanked 2 times

Dream Kudos: 225
My Contributions


I'm using the newest version of Dev C++ and I use it to compile C and
CODE
#include <stdio.h>

int main(void)
{
  puts("Hello");
  system("PAUSE");
  system("CLS");
  system("PAUSE");
  return 0;
}
does not work.
User is offlineProfile CardPM

Go to the top of the page

3 Pages V  1 2 3 >
Reply to this topicStart new topic
Time is now: 11/23/08 03:58AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month