home *** CD-ROM | disk | FTP | other *** search
/ stazsoftware.com / www.stazsoftware.com.tar / www.stazsoftware.com / futurebasic / sample-code / FlushVolume.sit / FlushVol next >
Text File  |  2003-08-22  |  1KB  |  38 lines

  1.  
  2. '~'A
  3. '                       Runtime : Rntm Appearance.Incl
  4. '                           CPU : Carbon
  5. '                    CALL Req'd : Off
  6. '~'B
  7.  
  8. /*
  9.      if you are writing an application that sends information to a server,
  10.      you will often need to flush the disk cache so that info is written
  11.      to the server, rather than sitting around in memory on a remote
  12.      machine. all you need to do is call fn FlushFileVol with a file spec.
  13.  
  14.      the file spec can be an file that is on the volume. usually. it is the file
  15.      that you are working with and want to have sent off to the server.
  16.  
  17.      this was written by rp.
  18. */
  19.  
  20. // flush the volume that the file belongs to
  21. local mode
  22. local fn FlushFileVol( f as ^FSSpec )
  23. '~'1
  24. dim paramBlock.64 // VolumeParam
  25.  
  26. BlockZero( @paramBlock, sizeof( paramBlock ) )
  27. paramBlock.ioVRefNum% = f.vRefNum
  28. end fn = fn PBFlushVolSync( paramBlock )
  29.  
  30.  
  31. // demo main program
  32. '~'1
  33. dim as FSSpec f
  34. long if ( files$( _FSSpecOpen,,, f ) != "" )
  35. fn FlushFileVol( f )
  36. end if
  37.  
  38.