|
Post by NoVaGene on Jul 28, 2004 2:17:22 GMT -5
Hi, I want to pass some arguments to an external program. Does any1 have ideas of how it can be done in basic4gl other than writing a function to poll every x interval from using file i/o? Thanks in advance! Rgds, Lucas Tan
|
|
|
Post by AHBanen on Jul 28, 2004 3:04:06 GMT -5
Lucas, You do not make very clear what you want to do. I presume you want to let the Basic4GL app to act as a primitive server sending out data using a file. (Y/N?) I also presume your external app acts as a client that will process new data when produced by the Basic4GL app but that should not process data otherwise. (Y/N?)
As Basic4GL has only primitive means to work with files (open,write/read, close) and no higher functions like checking for existance or even checking a last file access time. You will have to improvise using one or more files as semaphores.
E.g. The basic4GL app has some data for your client app. It checkes for a file "ClientReady" created by the client. If this exists it creates and writes its data to the file "Data" and after that first removes the file "ClientReady" and creates a file "ServerReady".
The clients looks for the file "ServerReady", when it exists it opens and reads the file "Data". After this it removes the file "ServerReady" and creates the file "ClientReady".
This would be the general scenario, it could be refined with more crosschecks etc. to avoid deadlock...
I hope this is what you needed Basic4GL appears to have very little means to communicate to the 'outside world' (like e.g. a way to shell out).
André
|
|
|
Post by AHBanen on Jul 28, 2004 3:15:33 GMT -5
Lucas, As you already posted elsewhere Basic4GL can't delete files. The semaphore solution becomes a little bit more complicated because of that as it means the server and client don't have to check for the existance but instead for the length of the "ClientReady"/"ServerReady" files, i.e. if they are length 0 or not (Basic4GL checking the immediate EndOfFile of "ClientReady" and writing at least one byte to the previous zero length "serverReady"). Alltogether it becomes pretty ugly André
|
|