Tedd OKANO
/
RPN_calc__based_on_K_and_R
just a sample of what can be done
Embed:
(wiki syntax)
Show/hide line numbers
getch.cpp
00001 #include "mbed.h" 00002 #include "calc.h" 00003 #include <ctype.h> 00004 00005 #define BUFSIZE 100 00006 00007 char buf[ BUFSIZE ]; 00008 int bufp = 0; 00009 00010 int getch( void ) 00011 { 00012 #if 1 00013 int c; 00014 c = (bufp > 0) ? buf[ --bufp ] : getchar(); 00015 if ( isprint( c ) && c != ' ' ) 00016 printf( "[%c]\r\n", c ); 00017 return c; 00018 #else 00019 return (bufp > 0) ? buf[ --bufp ] : getchar(); 00020 #endif 00021 } 00022 00023 00024 void ungetch( int c ) 00025 { 00026 if ( bufp >= BUFSIZE ) 00027 printf( "ungetch: too many characters\n" ); 00028 else 00029 buf[ bufp++ ] = c; 00030 } 00031
Generated on Sat Jul 30 2022 02:03:38 by 1.7.2