Page 1 of 1

PB 5.40 LTS ReadFile

Posted: Sun Oct 18, 2015 5:08 pm
by Lite
Hello

The comand Readfile makes problems with the new Version 5.40 LTS.
OS: Win7 Bit
PB: 5.40 LTS
PBEXE: unicode without debugger
TestFile File$: Ansicode.

File = ReadFile(#PB_Any, File$)

The Problem, ReadFile return Value 0, but it does not everytime.
On 10 starts failed 4. start the same source with debugger is the results.
On 10 starts 1 failed.

with the old lts version never have a problem with PB.

Greetings

Lite

Re: PB 5.40 LTS ReadFile

Posted: Sun Oct 18, 2015 5:54 pm
by ts-soft
No problems here!
I think, you have to post your code to see, what is wrong.

Here, my Testcode:

Code: Select all

EnableExplicit

OpenWindow(0, #PB_Ignore, #PB_Ignore, 800, 600, "Test")
EditorGadget(0, 5, 5, 790, 590)
Define File = ReadFile(#PB_Any, #PB_Compiler_Home + "SDK\Readme.txt", #PB_Ascii)

If File
  Define *mem = AllocateMemory(Lof(File))
  ReadData(File, *mem, MemorySize(*mem))
  CloseFile(File)
EndIf

SetGadgetText(0, PeekS(*mem, -1, #PB_Ascii))
FreeMemory(*mem)

Repeat
  Select WaitWindowEvent()
    Case #PB_Event_CloseWindow : Break
  EndSelect
ForEver
Greetings - Thomas

Re: PB 5.40 LTS ReadFile

Posted: Mon Oct 19, 2015 4:19 pm
by Lite
Hello

Thank your for the replay.

The sourcecode have 15000 lines.

Now found the error. 2 threads access to ReadFile together. I havent use the parameter
#PB_File_SharedRead. without blocked the other thread and come ReadFile-error.
by chance, it is noticed only in V5.40.
Now work great.

Greetings
Lite