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
PB 5.40 LTS ReadFile
Re: PB 5.40 LTS ReadFile
No problems here!
I think, you have to post your code to see, what is wrong.
Here, my Testcode:
Greetings - Thomas
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
PureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: PB 5.40 LTS ReadFile
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
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