473,387 Members | 1,532 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,387 software developers and data experts.

how to use clrscr and gotoxy function in Devc++ complier

how to use clrscr and gotoxy function in Devc++ complier//
even though i included header file of clrscr and gotoxy
Devc++ compiler giving an error .can i know how to use them.
Apr 30 '13 #1
4 10451
weaknessforcats
9,208 Expert Mod 8TB
Maybe you could post the errors you are getting?
Apr 30 '13 #2
lego13
3
gotoxy only works on systems that are compatible with IBM PC. A similar feature is in Turbo Pascal. The function is not compatible with Windows.

clrscr() can be used only in Borland C compiler. You may use system("cls");
May 7 '13 #3
Clear screen "clrscr() is not a standard function, niether in C or C++. So, using clrscr() is not always give you an answer, and it depends upon the compiler you installed and what library is available too. Some says: include library as: #include <conio.h> , this is also does not help much, and most of the times, it does not work because this library : <conio.h> is not standard library too.
So, to use clear screen, you have to use :
Expand|Select|Wrap|Line Numbers
  1. #include <iostream> WHICH IS KNOWN IN C++ and  system("cls"); as in the following example:
  2. #include <stdio.h>  
  3.            // #include <conio.h> some compilers      
  4.            //ask for this library, but in our case, no need.
  5. #include <iostream> // available in C++ standard Library 
  6. int main()
  7. {
  8.     char x;
  9.  
  10.  
  11.  for(int j=0; j<=10;j++)
  12.  {
  13.  
  14.     printf("Press any key to clear the screen.\n");
  15.     scanf("%c",&x);
  16.     // >>>>>>>>>>>>>>>>>  clrscr();  you can not use it in
  17.     // some compilers.......>>>>>>>>>><<<<<<
  18.     //   instead  use this one:   system("cls"); 
  19.    system("cls");     
  20. //clearscrean then leave 3 linsbefore writing vnew things
  21.    for(int k=0;k<=3;k++)
  22.    printf("\n");
  23.    for(int i=0; i<=3;i++)
  24.    {                  // repeat each of the following
  25.                       // line  4 times
  26.            for(int m=65;m<=80 ;m++)  
  27.  //m=65 is equivalant to character 'A' and so  on.....  
  28.            printf("%c",m); // print  m  as characters  and
  29.                            // not as decimal
  30.   printf("----Look at value of j after each  clearscreen YAHIA111%d",j);  
  31.            printf("\n");
  32.    }
  33.  
  34.    scanf("%c",&x);
  35. }
  36.    return 0;
  37. }
May 8 '13 #4
weaknessforcats
9,208 Expert Mod 8TB
Avoid using the system() function.

Firstly, the argument must be a valid command which can vary by operating system so your code may not be portable.

Secondly, you have no idea how many other calls will be made in order to execute your argument. You may find that two users of the same OS will may succeed or fail based on what installed utilities are on the respective machines.

Thirdly, you may have security issues since you can't tell what credentials are required to run your command. Maybe it works for you running as administrator but fails for your user who is not.

Instead try to not write a windowed program using the console. The console was written to emulate a teletype that has a roll of paper that feeds through it. Put your displays on the bottom line and let the display scroll.
May 8 '13 #5

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

Similar topics

0
by: webking | last post by:
hi friends, i am using devc++ to do c programs but i am unable to use standard turbo c functon such as getch(), clrscr(),getchar () can any one...
1
by: mohsin | last post by:
hi can anyone tell me the name of the header file for gotoxy function in visual c++ i know k turbo c main iss ki header file dos.h hootee hai but i dontknow in vc++
7
by: Hexer | last post by:
Hi and good day to all...I am new to the C language and whenever I tried to run the program I made, it won't because it says it has an "expression syntax error in function main"..what I don't get is...
1
DanielTNBaker
by: DanielTNBaker | last post by:
my code adds people it deletes people it can even search for people but can it edit people......nope! well this is what i got so far: { char name_val; struct client_struct client_rec; ...
6
by: arunk8186 | last post by:
Hi friends, When I compiled a program in which I have used gotoxy function in C , I get an error as "C:\Documents and Settings\e373616\Desktop\H1.cpp(58) : error C2065:...
10
by: playagain | last post by:
Why I can't use the clrscr(); and gotoxy(); in some compilers?
26
by: Albert | last post by:
Hi Are there any definitions of the gotoxy function on the internet. My compiler doesn't define it in any header Albert
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
1
by: bharathkumarsft | last post by:
I am using quincy 2005 compiler. The functions gotoxy() and clrscr() are not working. How can i use those functions in my compiler?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
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...

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.