home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast.iso
/
pcmag
/
vol7n03.zip
/
PP703.ZIP
/
TRY.C
< prev
next >
Wrap
C/C++ Source or Header
|
1987-12-15
|
940b
|
31 lines
/*
TRY.C --- demonstrates binding of TRYATOI.ASM
and ATOI.ASM to a C program
Ray Duncan, October 1987
*/
#include <stdio.h>
int TRYATOI(const char *); /* declare function */
main(int argc,char *argv[])
{ char buff[80]; /* keyboard input buffer */
int ivar; /* an integer variable */
while(1)
{ /* display prompt */
printf("\n\nEnter a number (Q to quit): ");
gets(buff); /* read string from keyboard */
/* exit if 'Q' or 'q' entered */
if( buff[0] == 'Q' || buff[0] == 'q') break;
/* call MASM binding */
ivar=TRYATOI(buff); /* string to int */
/* now display result */
printf("\n\t TRYATOI(your entry) = %d ", ivar);
}
}