Mostrar banner dinámico en consola

#include <stdio.h> #include <stdlib.h> #include <Windows.h> #define LARGO_BUFFER 7 // Por si no se usa borland, de ser así, sustituir // esta función por su equivalente en la biblioteca conio.h void gotoxy(int x, int y); void MostrarBanner(char* Texto, int LargoBuffer); int main() { char Texto[25]; // Texto de 24 caracteres + NULL strcpy(Texto, "Esto tiene 24 caracteres"); MostrarBanner(Texto, LARGO_BUFFER); printf("\n\n"); system("pause"); } void MostrarBanner(char*Texto, int LargoBuffer) { int i, marca = 0; char *PTexto; PTexto = Texto; for (i = 0; i < strlen(Texto)+1-LARGO_BUFFER; i++) { marca = PTexto[LARGO_BUFFER]; PTexto[LARGO_BUFFER] = 0; gotoxy(0,0); printf("%s", PTexto); PTexto[LARGO_BUFFER] = marca; Sleep(300); PTexto++; } } void gotoxy(int x, int y) { HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); _COORD pos; pos.X = x; pos.Y = y; SetConsoleCursorPosition(hConsole, pos); }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.