;; write-multiple-records.sal -- reading all data from a file ;; (c) 2008 by Roger B. Dannenberg define function write-multiple-records() begin with in-data = open("midi.dat"), out-data = open("midi-out.dat", direction: keyword(output)) if ! in-data | ! out-data then begin display "error", in-data, out-data if in-data then exec close(in-data) if out-data then exec close(out-data) return #t end loop for midi-note = read(in-data) for velocity = read(in-data) for channel = read(in-data) while midi-note exec format(out-data, "midi-note = ~a ", midi-note) exec format(out-data, "velocity = ~a channel ~a~%", velocity, channel) end exec close(in-data) exec close(out-data) end exec write-multiple-records()