is it possible to make a dos program that
writes
"WELLCOME"
letter after letter
on the exact same spot!
..............................................
..............................................
please help!
if u know what i mean?
is it possible to make a dos program that
writes
"WELLCOME"
letter after letter
on the exact same spot!
..............................................
..............................................
please help!
if u know what i mean?
yes use the gotoxy function at the bottom of the FAQ, to return the cursor to the last position each letter that is typed.
http://www.cprogramming.com/boardfaq.html
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
i didn't get that!
#include <windows.h>
#include <dos.h>
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_H ANDLE), coord);
}
int main()
{
char msg[] = "FAQ";
int count = 0;
while(msg[count] != '\0')
{ gotoxy(1,1);
putch(msg[count++]);
sleep(1);
}
}
doesn't work when i compile!
what about it doesn't work?
here's a revised one?
Code:#include <windows.h> #include <stdio.h> // need this header void gotoxy(int x, int y) { COORD coord; coord.X = x; coord.Y = y; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord); } int main() { char msg[] = "FAQ"; int count = 0; while(msg[count] != '\0') { gotoxy(1,1); putch(msg[count++]); sleep(1); } return 0; // and you forgot the return. }
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.
#include <stdio.h> // need this header
It compiled without that header using borland 4.5 ok. Seeing you left the sleep() in and took out dos. Is it now located in the windows.h?
You could also use:
printf("W\be\b\l\bc\b\o\bm\be\r");
Won't look like much because it prints each letter over each other.
\b is backspace. \r is a return without a newline (cursor ends up at beginning of line).
Allegro precompiled Installer for Dev-C++, MSVC, and Borland: http://galileo.spaceports.com/~springs/
>It compiled without that header using borland 4.5 ok.
probably would in MSVC also that doesnt mean its right...
>Seeing you left the sleep() in and took out dos. Is it now located in the windows.h?
eh..um..woops...
there is a Sleep() function in windows.h but the truth is i forgot to put the right header for it.
it is rather compiler dependant
_sleep() is in stdlib.h in MSVC
_sleep() is in unistd.h in Code Warrior
sleep() is in dos.h? in Borland 4.5
my mistake sorry.
Last edited by no-one; 01-24-2002 at 12:54 AM.
ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.