Code: Select all
#include "file.bi"
#include "crt/stdio.bi"
const as string fifoname="/root/tempfifo"
if not fileexists(fifoname) then
shell("mkfifo "+fifoname)
end if
var file=fopen(fifoname,"w")
for i as ulong=0 to 999
fprintf(file,"Hello:"+str(i)+chr(11)+chr(13))
fflush(file)
print "done",i
sleep 50
next
fclose(file)
Code: Select all
#include "file.bi"
#include "crt/stdio.bi"
const as string fifoname="/root/tempfifo"
if not fileexists(fifoname) then
shell("mkfifo "+fifoname)
end if
var file=fopen(fifoname,"r")
dim as long c
while c>=0
c=fgetc(file)
print chr(c);
wend
fclose(file)
You may have to delete the tempfifo file if you break anything, as it will hold on to broken state and make trouble for you.
I'll experiment a bit more and see if it can be made robust enough for general use.