Thread: Creating a loading symbol

  1. #1
    Unregistered
    Guest

    Creating a loading symbol

    I was wondering if anyone knew or had an example code of how they make the loading spinning symbol I've seen on boot loaders and such where the keys go like this

    | / - and repeat making it look like a spinning line.

    I tried producing it with /b but it didn't work out to well I thought it was a neat effect I could use for some programs while waiting for them to load or do work and was hoping someone could help me out?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Did you remember to use fflush?

    This works compiled with DJGPP
    Code:
    #include <stdio.h>
    #include <dos.h>
    
    int main ( ) {
        char spinner[] = "|/-\\";
        int i, j;
        printf( "Loading...." );
        for ( i = 0 ; i < 10 ; i++ ) {
            for ( j = 0 ; j < 4 ; j++ ) {
                printf( "%c\b", spinner[j] );
                fflush( stdout );
                delay( 250 );
            }
        }
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM