Category : Files from Magazines
Archive   : CUJ9201.ZIP
Filename : 1001046A

 
Output of file : 1001046A contained in archive : CUJ9201.ZIP
/*
* Listing 2: main() routine and test code for get_str().
* Includes the OS-dependent routines sys_getchar()
* and sys_putchar().
*/
#include
#include
#include
#include

#define INBUFSIZ 70
char inbuf[INBUFSIZ + 1];

void get_str( char *str, int len );

void main( void )
{

while (1)
{
printf("\ntype 'quit' to quit.\nprompt> ");
get_str(inbuf, INBUFSIZ);

if (stricmp(inbuf, "quit") == 0)
break;

printf(" Got: \"%s\"\n", inbuf);
}
}


/*********************************************************
* The following two routines will need to be changed,
* in order to use get_str() in a different environment.
*********************************************************/

/*
* Put a character to the output device.
* Expand \n to \r\n.
*/
void sys_putchar( char ch )
{

putchar(ch);
if (ch == '\n')
putchar('\r');
}


/*
* Get a character from the input device.
* Use the BIOS call so we can detect arrow keys.
*/
int sys_getchar( void )
{
int ch;

ch = bioskey(0); /* wait and get a key */

if ((ch & 0xff) != 0) /* if not an extended key, */
ch &= 0xff; /* use only the ASCII part */
return (ch);
}


  3 Responses to “Category : Files from Magazines
Archive   : CUJ9201.ZIP
Filename : 1001046A

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/