Source Code File 06-05_marquee1
06-05_marquee1.c
#include <ncurses.h> #include <string.h> int main() { char text[] = "Armstrong walks on moon!"; char *t; int len; initscr(); len = strlen(text); t = text; /* initialize pointer */ while(len) { move(5,5); /* insert same spot */ insch(*(t+len-1)); /* work backwards */ refresh(); napms(100); /* .1 sec. delay */ len--; } getch(); endwin(); return(0); }
Output Screenshot
Notes
* Because the code fetches the string's length (Line 12), you can change the text at Line 6 to something perhaps more current. (I use this phrase because it was in a marquee demo program I worked on when I first learned to program.)
Copyright © 1997-2024 by QPBC.
All rights reserved