Seppo Mustonen : Programming Survo in C

Functions in library SURVO.LIB

sur_wait
Summary

int sur_wait(time,display,break)
long time;        /* waiting time in ms */
int (*display)(); /* display function during wait */
int break;        /* 1: possible to break by any key */
                  /* 0: not possible to break */
Description

The sur_wait function creates a wait lasting time milliseconds. During the wait the display function is called once every second (to indicate the time elapsed, for example). If break=1, the wait can be interrupted by pressing any key.

Return Value

sur_wait returns -1 if the wait has been interrupted by a key. Otherwise 0 is returned.

Example

#include <stdio.h> 
#include "survo.h"

int sec=0;
main()
        {
        extern seconds();
        sur_wait(20000L,seconds,1);
        }
seconds()
        {
        printf(" %d",++sec);
        }

/* This program counts to 20 seconds */


Front page of Survo C libraries