home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / progm / flash-c1.zip / DISKDEMO.C < prev    next >
Text File  |  1990-02-11  |  2KB  |  77 lines

  1. #include <fpclib.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <conio.h>
  6.  
  7. void TestDosErrNo( void );
  8.  
  9.  
  10. char      Buf[20000];
  11. FILE      Text;
  12. long int  FilSize;
  13. int       Handle,NBytes,WBytes;
  14. char      Done,Ch;
  15.  
  16. void TestDosErrNo( void )
  17. {
  18.    int rc = 0;
  19.  
  20.    if ( DosErrNo || CErrCode ) {
  21.       printf( "DosErrNo   = %d     \n", DosErrNo   );
  22.       printf( "CErrCode   = %d     \n", CErrCode   );
  23.       printf( "CErrType   = %d     \n", CErrType   );
  24.       printf( "CErrDrive  = %d     \n", CErrDrive  );
  25.       printf( "CErrDevice = %s   \n\n", CErrDevice );
  26.       ResetErrCodes();
  27.       rc++;
  28.    }
  29.    printf("\nPress Enter to continue...");
  30.    GetKey();
  31.    printf( "\n" );
  32. }
  33.  
  34. void main( void )
  35. {
  36.    VioInit();
  37.    GotoxyAbs( 1, 1 );
  38.  
  39.    memset( Buf, 'A', sizeof( Buf ) );
  40.    ClrWin( 1, 1, 80, 25, 7 );
  41.    SetInt24();
  42.  
  43.    printf( "doing createfile\n" );
  44.    CreateFile( "a:Test", 0, &Handle );
  45.    TestDosErrNo();
  46.  
  47.    printf( "doing writefile\n" );
  48.    WriteFile( Handle, sizeof( Buf ), Buf, &WBytes );
  49.    TestDosErrNo();
  50.  
  51.  
  52.    printf( "doing closefile\n" );
  53.    CloseFile( Handle );
  54.    TestDosErrNo();
  55.  
  56.    printf( "doing openfile\n" );
  57.    OpenFile( "A:Test", 2, &Handle );
  58.    TestDosErrNo();
  59.  
  60.    printf( "doing FSeek\n" );
  61.    printf( "FilSize = %ld\n", FSeek( Handle, 0, 15100L ) );
  62.    TestDosErrNo();
  63.  
  64.    printf( "doing FSeek again...\n" );
  65.    printf( "FilSize = %ld\n", FSeek( Handle, 0, 0L ) );
  66.    TestDosErrNo();
  67.  
  68.    printf( "do ReadFile\n" );
  69.    ReadFile( Handle, sizeof( Buf ), Buf, &WBytes );
  70.    TestDosErrNo();
  71.    printf( "Number of bytes read = %u\n", WBytes );
  72.  
  73.    printf( "do CloseFile\n" );
  74.    CloseFile( Handle );
  75.    TestDosErrNo();
  76. }
  77.