Category : C Source Code
Archive   : TOOLS153.ZIP
Filename : K_GETLNG.C

 
Output of file : K_GETLNG.C contained in archive : TOOLS153.ZIP

/****************************************************************/
/* */
/* Filename: K_GETLNG.C */
/* */
/* Author: Mike McCabe */
/* */
/* Release Date: October 14, 1988 */
/* */
/* Current Version: 1.0 */
/* */
/* Project Name: TC-Tools Library */
/* */
/* Compatibility: Turbo C 1.5 and 2.0 */
/* IBM-PC/PS2 Video Subsystem */
/* */
/* Copyright: (C)opyright 1988 by Mike McCabe */
/* All Rights Reserved */
/* */
/* Subroutines Called: k_formleft */
/* k_formright */
/* atol */
/* return */
/* */
/* Globals Used: FROMLEFT */
/* */
/****************************************************************/
/* */
/* Description: */
/* */
/* This routine will allow the user to input a long */
/* on the screen. */
/* */
/* Calling Parameters: */
/* */
/* long k_getlong(dir,row,col,attr,prec); */
/* */
/* keydir dir; direction of get */
/* int row; row for upper left corner */
/* int col; column for upper left corner */
/* int attr; screen attributes */
/* int prec; number of digits */
/* */
/****************************************************************/
/* */
/* Revision History: */
/* */
/* Version Date Description */
/* ------- -------- ----------- */
/* 1.0 11/14/88 Original Release */
/* */
/****************************************************************/

/* Declare needed .h files */
#include
#include
#include "tctools.h"

/* Declare k_getlong function */
long k_getlong(dir,row,col,attr,prec)
KEYDIR dir; /* direction */
int row; /* row - upper left */
int col; /* column - upper left */
int attr; /* screen attributes */
int prec; /* number of digits */
{
char tmp[20]; /* temporary string */
char fmt[20]; /* format for long */
int i; /* counter */
long number; /* return value */

/* clear string buffer */
tmp[0] = '\0';

/* fill in the format */
for ( i = 0; i < prec; i++ ) {
fmt[i] = '9';
};

/* fix the string */
fmt[i] = '\0';

/* if direction is left then */
if ( dir == FROMLEFT ) {

/* call k_formleft to do video handling for long get */
k_formleft(tmp,fmt,row,col,attr);

/* else */
} else {

/* call k_formright to do video handling for long get */
k_formright(tmp,fmt,row,col,attr);

/* end if */
};

/* convert string to long format */
number = atol(tmp);

/* return long read */
return(number);

/* end of k_getlong */
};