I've got BOOM

Post bugreports for the Windows version here
Sergey
User
User
Posts: 91
Joined: Wed Jan 12, 2022 2:41 pm

I've got BOOM

Post by Sergey »

Hi,
ReadFile
Syntax: Result = ReadFile(#File, Filename$ [, Flags])
Flags (optional) ... #PB_File_BOM : if the file contains a BOM, it will be handled automatically (no need to use ReadStringFormat()).
The detected format will be automatically used by the read and write string functions.

Ok, just test this flag
Create empty source file, write it near with program and name it "bom.pb"
Small code for reading file

Code: Select all

hFile = ReadFile(#PB_Any, "bom.pb", #PB_File_BOM)
Memory error in log :(
If we make zero as #file the program will execute without error

PB630 Win10x64 (Unicode)
breeze4me
Enthusiast
Enthusiast
Posts: 672
Joined: Thu Mar 09, 2006 9:24 am
Location: S. Kor

Re: I've got BOOM

Post by breeze4me »

Confirmed.

The OpenFile function has the same problem.

Code: Select all

file.s = GetTemporaryDirectory() + "bom_test.txt"
If CreateFile(0, file, #PB_File_BOM)
  WriteStringN(0, "test")
  CloseFile(0)
  
  If OpenFile(0, file, #PB_File_BOM)  ; no error.
  ;If ReadFile(0, file, #PB_File_BOM)  ; no error.
    
    CloseFile(0)
  EndIf
  
  
  f = OpenFile(#PB_Any, file, #PB_File_BOM)   ; IMA
  ;f = ReadFile(#PB_Any, file, #PB_File_BOM)   ; IMA
  If f
    CloseFile(f)
  EndIf
  
EndIf
Post Reply