_G.io = {} io.write = write function io.open(n,m) m=m or "rb" local h=fopen(n,m) if h then if h and m:sub(1,1) == "w" then return cB(function(bt) bt.s="o" s("io worker: "..n,function() while true do if bt.s ~= "o" and bt.b == "" then fclose(h) break end local nd = bt:read(2048) if nd ~= nil and nd ~= "" then fwrite(h,nd) end C.yield() end end) end,function(bt) bt.s="c" end) elseif h and m:sub(1,1) == "r" then return cB(function(bt) local sb = "" repeat bt.b=bt.b..sb sb=fread(h,2048) until sb == "" or sb == nil fclose(h) C.yield() end,function() end) end else return false end end