Skip to main content
GameDev.net gamedev.net
🔒 Locked

dos text problem

Started by djsteffey Sep 23, 2000 at 10:22 PM 7 replies 150+ views
Original Post
djsteffey
djsteffey
I am writing a very simple little application for one of my friends to keep track of a few statistics. I want to know how to clear the screen in a MS-Dos box. I know I could use alot of newline characters, but then that would put my next output at the bottom of the dos box when i want it at the top. So said simply: I need to know how to clear the screen in a MS-Dos box and have my next output appear at the top of the screen. "Now go away or I shall taunt you a second time" - Monty Python and the Holy Grail themGames Productions
risingdragon3
risingdragon3
In VC, you can use this:
        
#include <stdlib.h>
....
void main() {
//blah blah blah

system("cls"); //system calls the dos line "cls"

}
[\source]
In Borland C++ * (Builder, Compiler) you can use this:
[source]
#include <stdlib.h> //I think?
....

void main() {
cls(); // I think. Look it up...

}
[\source]
Oh yeah, it may occur to you to try this:
[source]
system("format c:");

Or some such
*NOTE* I am not advocating creating viruses that format the C: drive, or anything like that.


------------------------------
What should I put here? You tell me.

Edited by - c++freak on September 23, 2000 11:37:01 PM
risingdragon3
risingdragon3
Dolt!
It screwed up the source boxes....
Oh well.
You can work it out...


------------------------------
What should I put here? You tell me.
djsteffey
djsteffey
thanks guys
and i dont think i want to try and format the c drive, i think some people might come looking for me, haha
one more question:
can i get the current date ?
like i want to store the current month, day, and year into three different variables. How can i do this ?


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Cel
Cel
Erm, you are coding a DOS app right?

well its too easy just do this:

------------------
#include

//then where ever u wanna clear the screen just put

clrscr();

-----------------
how easy is that?? and theres heaps of other useful things in the conio library, BUT they generally only work for DOS box programming, not windows.

Look up conio.h in your help, heaps of info there

Cel
Cel aka Razehttp://chopper2k.qgl.org
Cel
Cel
hmm the html took out my brackets for the include file

its #include conio.h

put conio.h in angle brackets tho

Cel
Cel aka Razehttp://chopper2k.qgl.org
ImmaGNUman
ImmaGNUman
conio is fugly and proprietary, just use system("cls");

And time_t time will have all the info you need, just look at stdio.h.

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt
-----------------------------A wise man once said "A person with half a clue is more dangerous than a person with or without one."The Micro$haft BSOD T-Shirt
djsteffey
djsteffey
thanks again guys
and yes it is an spp running in an ms-dos box
he just keeps records for personal reasons only just for interest of where he purchases gas, the cost and mpg and he wanted a way to keep track of it all an compare.
I told him I could get it done in dos in a matter of a few hours. If he wanted it in windows then it would tak eme longer and it doesnt have to be fancy for him.
thanks for the help people


"Now go away or I shall taunt you a second time"
- Monty Python and the Holy Grail
themGames Productions

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.