home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / System / Swatch / Development / swatch 1.2 / humble.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-10-22  |  1.0 KB  |  46 lines  |  [TEXT/KAHL]

  1. #include <stdio.h>
  2. #include <types.h>
  3.  
  4. #include <DebugPrint.h>
  5. #include <pstring.h>
  6.  
  7. main()
  8. {
  9.     CInfoPBRec orig_cat_info_PB, new_cat_info_PB;
  10.     HParamBlockRec write_PB;
  11.     register Boolean previous_exists;
  12.     Handle snd;
  13.     static char riff_file_name[] = "\pSwatch Riff";
  14.  
  15.     snd = GetNamedResource( 'snd ', "\pBoingo" );
  16.     if ( !snd )
  17.         return;
  18.     HLock( snd );
  19.  
  20.     write_PB.fileParam.ioNamePtr = (StringPtr) riff_file_name;
  21.     write_PB.fileParam.ioVRefNum = 0;
  22.     write_PB.fileParam.ioFVersNum = 0;
  23.     PBCreate( &write_PB, FALSE );
  24.  
  25.     write_PB.ioParam.ioVersNum = 0;
  26.     write_PB.ioParam.ioPermssn = 0;
  27.     write_PB.ioParam.ioMisc = NULL;
  28.     write_PB.ioParam.ioRefNum = 0;
  29.     if ( PBOpen( &write_PB, FALSE ) )
  30.         goto cant_save;
  31.  
  32.     write_PB.ioParam.ioBuffer = (Ptr) StripAddress( *snd );
  33.     write_PB.ioParam.ioReqCount = GetHandleSize( snd );
  34.     write_PB.ioParam.ioPosMode = fsFromStart;
  35.     write_PB.ioParam.ioPosOffset = 0;
  36.     if ( PBWrite( &write_PB, FALSE ) )
  37.         goto cant_save;
  38.  
  39.     PBClose( &write_PB, FALSE );
  40.     return;
  41.  
  42. cant_save:
  43.     if ( write_PB.ioParam.ioRefNum )
  44.         PBClose( &write_PB, FALSE );
  45. }
  46.