ReadFile() and #PB_Status_Error

Just starting out? Need help? Post your questions and find answers here.
User avatar
Peter
Posts: 1086
Joined: Mon Feb 24, 2014 10:17 pm
Location: 127.0.0.1:9080
Contact:

ReadFile() and #PB_Status_Error

Post by Peter »

Hello,

if i load a File (via ReadFile) which doesn't exists, i get no #PB_Status_Error.

Instead the FileContent contains the 404-Message (see code below).

Is that intended?

Code: Select all

Procedure ReadFileCallback(Status, Filename.s, File, Size)
  
  Select Status 
      
    Case #PB_Status_Loaded
      
      Debug "#PB_Status_Loaded"
      Debug "Filename: " + Filename
      Debug "File: "     + File
      Debug "FileContent: " + ReadString(File, #PB_File_IgnoreEOL)
      Debug "---"
      
      CloseFile(File)
      
    Case #PB_Status_Error
      
      Debug "#PB_Status_Error"
      Debug "Filename: " + Filename
      Debug "File: "     + File
      Debug "---"
      
  EndSelect
  
EndProcedure

ReadFile(#PB_Any, "/resources/exists.txt", @ReadFileCallback())
ReadFile(#PB_Any, "/resources/notexists.txt", @ReadFileCallback())
Thanks in advance & Greetings ... Peter