GetFileStatus
Status = GetFileStatus(ChannelIndex)
 
Parameters:

    ChannelIndex = The index of the file channel you wish to query
Returns:

    Status = The current status of this file channel (0= free / 1= In use)
 

      The GetFileStatus function returns the current status of a file channel. If a file channel is free, GetFileStatus will return a 0 (free) and a 1 (true) if it's not.



FACTS:


      * None



Mini Tutorial:


      This example uses GetFileStatus to validate a file channel is free for use prior to using it.


  
  
; Check if a file channel #1 is in use?
  If GetFileStatus(1)=false
     
   ; Display a message
     Print "This File Channel #1 is Free for use"
     
   ; A file called "Test.txt" using file channel #1
     WriteFile "Test.txt",1
     
   ; Dump the string "hello World" to this file
     WriteString 1,"HellO World"
     
   ; close file channel #1
     CloseFile 1
     
   ; Saved File
     Print "Saved File"
     
     
   ; Removing the temp file
     DeleteFile "Test.txt"
     
  EndIf
  
; display the screen and wait for a key to be pressed
  Sync
  WaitKey
  
  




This example would output the following since all file channels are free when the program starts.

  
  This File Channel #1 is Free For use
  Saved File
  

 
Related Info: EndOfFile | GetFilePos | OpenFile | ReadFile | WriteFile :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com