All pastes #2052233 Raw Edit

Someone

public text v1 · immutable
#2052233 ·published 2011-04-30 12:27 UTC
rendered paste body
isfunc  =>
store   check_include
test    [~(check_include)]
        error   "io lib require std lib to work. Please use <require std> before <require io>."
end

load io

instr   io.writein      io.writein_lbl

ret

# Standard instruction to write some strings to a file
label      io.writein_lbl
           test [param_nb{1]
                warning "Too few arguments passed to io.writein"
                ret
           end

           => fd io.open param1 w+
           test [fd=-1]
                define  warn_msg        [Cannot open file +param1+ for writing]
                warning warn_msg
                ret
           end

           define       cur_param       2
           test [cur_param{param_nb]
                io.write        fd      [$(param+cur_param)]
                define          :cur_param      [cur_param+1]
           back

           io.close     fd
ret