Skip to content

Instantly share code, notes, and snippets.

@pedro-w
Last active March 19, 2018 07:39
Show Gist options
  • Save pedro-w/aedb05fe3428ec68ce95a54e0c57a964 to your computer and use it in GitHub Desktop.
Save pedro-w/aedb05fe3428ec68ce95a54e0c57a964 to your computer and use it in GitHub Desktop.
Dylan file stream

file-reader.dylan

Module: file-reader
Synopsis: 
Author: 
Copyright: 

define function main
  (name :: <string>, arguments :: <vector>)
  let stm = make(<file-stream>, direction: #"input", locator: "test.txt");
  let text = read-to-end(stm);
  close(stm);
  format-out("Text: %s\n", text);
  exit-application(0);
end function main;

main(application-name(), application-arguments());

library.dylan

Module: dylan-user

define library file-reader
  use common-dylan;
  use system;
  use dylan;
  use io;
end library file-reader;

define module file-reader
  use dylan;
  use file-system;
  use common-dylan;
  use format-out;
  use streams;
end module file-reader;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment