Category : C Source Code
Archive   : BTREE.ZIP
Filename : BTUSE.C

 
Output of file : BTUSE.C contained in archive : BTREE.ZIP
/* sample user program to test btsys */

struct {
unsigned fcode;
unsigned keylen;
unsigned filhand;
unsigned datapt;
char filkey[17];
char filnam[15];
} btstruct, *structp = &btstruct;

main ()

{
int code, number;
char literal[17];
int retcode;

do {
printf ("enter function code\n");
scanf ("%d", &code);
switch (code) {

case 0 : /* initialize system */
structp->fcode = code;
retcode = btfunc (structp);
break;
case 1 : /* file create */
case 2 : /* file open */
printf ("enter file name\n");
scanf ("%s", literal);
strcpy (structp->filnam, literal);
printf ("enter keylength\n");
scanf ("%d", &number);
structp->keylen = number;
structp->fcode = code;
retcode = btfunc (structp);
printf ("retcode %d filhand %d\n",
retcode, structp->filhand);
break;
case 3 : /* file close */
printf ("enter file handle\n");
scanf ("%d", &number);
structp->filhand = number;
structp->fcode = code;
retcode = btfunc (structp);
printf ("retcode %d from close\n", retcode);
break;
case 4 : /* insert keys */
printf ("enter file handle\n");
scanf ("%d", &number);
structp->filhand = number;
printf ("enter key\n");
scanf ("%s", literal);
strcpy (structp->filkey, literal);
printf ("enter data pointer\n");
scanf ("%d", &number);
structp->datapt = number;
structp->fcode = code;
retcode = btfunc (structp);
printf ("retcode %d from insert\n", retcode);
break;
case 5 : /* random read */
printf ("enter file handle\n");
scanf ("%d", &number);
structp->filhand = number;
printf ("enter key\n");
scanf ("%s", literal);
strcpy (structp->filkey, literal);
structp->fcode = code;
retcode = btfunc (structp);
printf ("retcode %d key %s datapt %d\n",
retcode, structp->filkey, structp->datapt);
break;
default : break;
} /* end switch */
} while (code != -1);/* end while */

} /* end btuse */


  3 Responses to “Category : C Source Code
Archive   : BTREE.ZIP
Filename : BTUSE.C

  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/