Page 1 of 1
Posted: Fri Aug 30, 2002 12:45 am
by BackupUser
Restored from previous forum. Originally posted by Andy.
When using several threads, is it then possible to access files, from within the threads, which were opened before calling the threads?
Andy
Posted: Fri Aug 30, 2002 1:04 am
by BackupUser
Restored from previous forum. Originally posted by ricardo.
Originally posted by Andy
When using several threads, is it then possible to access files, from within the threads, which were opened before calling the threads?
Andy
Its possible:
Code: Select all
Procedure ReadOpenedFile(FileNum.l)
UseFile(FileNum)
MessageRequester("string",ReadString(),0)
CloseFile(FileNum)
EndProcedure
If OpenWindow(0,100,150,450,200,#PB_Window_SystemMenu,"Test")
CreateGadgetList(WindowID())
ButtonGadget(1,200,100,50,25,"Test")
Repeat
EventID=WaitWindowEvent()
Select EventID
Case #PB_EventGadget
Select EventGadgetID()
Case 1
If OpenFile(0,"somedata.txt");create a file and store some string
WriteString("1234567")
CloseFile(0)
EndIf
If OpenFile(1,"somedata.txt");open the file and call the procedure in a thread
ThreadID = CreateThread(@ReadOpenedFile(),1)
EndIf
EndSelect
EndSelect
Until EventID=#PB_EventCloseWindow
EndIf
End
Posted: Fri Aug 30, 2002 2:06 am
by BackupUser
Restored from previous forum. Originally posted by Andy.
Ricardo,
Thank You very much:)
I just bought PB, and I find the help a little hard to understand, but this messageboard is SO HELPFUL!
Thanks mate, I'll check out Your code right away!
Andy