home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / midifos2.zip / MFSTRING.C < prev    next >
C/C++ Source or Header  |  1993-06-14  |  614b  |  39 lines

  1. /* This program, when compiled with the midifile(3) library, will */
  2. /* print only the text messages in a standard MIDI file. */
  3.  
  4. #include <stdio.h>
  5. #include <ctype.h>
  6. #include <os2.h>
  7.  
  8. #include "midifile.h"
  9.  
  10. FILE *F;
  11.  
  12. int mygetc() { return(getc(F)); }
  13.  
  14. void mytext(int type, int leng, char *msg)
  15. {
  16.     char *p;
  17.     char *ep = msg + leng;
  18.  
  19.     for ( p=msg; p<ep ; p++ )
  20.         putchar( isprint(*p) ? *p : '?' );
  21.     putchar('\n');
  22. }
  23.  
  24. main(argc,argv)
  25. char **argv;
  26. {
  27.     if ( argc > 1 )
  28.         F = fopen(argv[1],"r");
  29.     else
  30.         F = stdin;
  31.  
  32.     Mf_getc = mygetc;
  33.     Mf_text = mytext;
  34.  
  35.     midifile();
  36.  
  37.     exit(0);
  38. }
  39.