I Summon Clear Screen

Sorry to be such a gimmy gimmy... but I couldn't find any threads on some code that clears the screen, just like DOS's 'CLS' and Bash's 'Clear'...I need a function that does the same thing as both CLS and Clear. Thanks for reading and or helping out.

You don't want to do that. It's considered rude in command line programs and in all others building up your own screen will replace what's underneath it anyway (at least while your application is running).

There's no platform independent way to achieve it btw (probably because of that) so if you insist you'll have to plow through your compiler documentation to see if there's a function for it and how to call it.
You could of course always figure out the memory location of your screenbuffer and manually poke zeros into each position and hope.

Just to be sure that we are on the same page... the function should only clear the 'output' on the screen... not do anything with the actual program or command prompt. I want to create 'animation' in the command prompt, I have done this before with Batch files by echoing text and then 'cls' and echoing the text in another spot on the line. I want to be able to do the same, by just clearing whats on there and then creating the illusion of animation.

Just to be sure that we are on the same page... the function should only clear the 'output' on the screen... not do anything with the actual program or command prompt. I want to create 'animation' in the command prompt, I have done this before with Batch files by echoing text and then 'cls' and echoing the text in another spot on the line. I want to be able to do the same, by just clearing whats on there and then creating the illusion of animation.

I'm having trouble deciding if you're stupid or just can't read well. We understand exactly what you want. You've had three useful replies and two viable solutions. What need is there to be on the same page if you already have a workable answer?

>when I use clrscr(); it gives me a linker error that it's undefined.
clrscr is pretty much restricted to Borland compilers. Use another method. I'm sure someone will be happy to share their lame, stupid way of clearing the screen with you.

What exactly are you trying to do and on what system with what compiler? Since this is an implementation-dependent question, it's helpful to know what implementation you're using. Otherwise there's now way I can give you a decent solution.

I'm just in a learning phaze. I'm not making anything grand right now, but I'm just making simple things and learning from the experience. I'm just curious own how it all works, that's all. I'll see if I can search harder in google or my local libraries "book libraries :cheesy: ."

>To Narue: in your own opinion, what would be a good compiler to use?
Dev-C++ is a good one for Windows, but just about any modern compiler is workable if you know your way around the language and the system.

have you got the main libraries attached to the project? an undefined linker error usually is when th library is not in the project, no matter what headers are included (this always happens when people learn DirectX!!!!)

when I use clrscr(); it gives me a linker error that it's undefined. Could this be an issue with my library? I'm using Dev-C++ 4.

Am I supposed to alter the header file, I guess to define it?

For those that aren't aware, the linker does its thing after the compiler. It apparently compiled okay. But it will not link because the code written to do what you want is missing. Generally this is in a library that is also supported by a compiler.

It's tantamount to me saying, "Here's a check for a million dollars". If I'm Bill Gates, I could do that. But I'm not. And nothing that I can forsee is going to give me access to his bank accounts.

But I said, "here's a million dollars" -- why can't it be so? It just is. Such is the way of headers and libraries. The header says, "Here's how you can have a million dollars". It's up to the library to come through and look for Bill Gates. Without the library, your code may simply be making promises your linker can't keep.

For those that aren't aware, the linker does its thing after the compiler. It apparently compiled okay. But it will not link because the code written to do what you want is missing. Generally this is in a library that is also supported by a compiler.

It's tantamount to me saying, "Here's a check for a million dollars". If I'm Bill Gates, I could do that. But I'm not. And nothing that I can forsee is going to give me access to his bank accounts.

But I said, "here's a million dollars" -- why can't it be so? It just is. Such is the way of headers and libraries. The header says, "Here's how you can have a million dollars". It's up to the library to come through and look for Bill Gates. Without the library, your code may simply be making promises your linker can't keep.

Thanks, I've been wondering about the header files, "where's the code for the things I'm calling", if there was more to it. I'll be checking if "Bill" is even there.

Because conio.h is not part of the C standard. It is a Borland extension, and works only with Borland compilers (and perhaps some other commercial compilers). Dev-C++ uses GCC, the GNU Compiler Collection, as it's compiler. GCC is originally a UNIX compiler, and aims for portability and standards-compliance.

If really can't live without them, you can use Borland functions this way:
Include conio.h to your source, and add C:\Dev-C++\Lib\conio.o to "Linker Options" in Project Options (where C:\Dev-C++ is where you installed Dev-C++).
Please note that conio support is far from perfect. I only wrote it very quickly.

I feel horrible about how long this "tutorial" on cls, went. I want to thank all of you who helped me. I learned more than just being able to clear the output on the screen. Narue's example was the one that works perfectly with my compiler, its just the "clrscr()" method that gave me strife. I have a few friends that are using the same compiler I am, so I'll have an answer when they try to use conio.h and clrscr(). :mrgreen:

>I feel horrible about how long this "tutorial" on cls, went.
Hey, no biggie. We're happy to continue helping until you feel comfortable with the answers. It's a waste of time for all parties if you walk away without an understanding of the solution. :)

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...