概要
paiza.ioでelixirやってみた。
File使ってみた。
サンプルコード
File.mkdir!("pack")
File.ls!
|> IO.inspect
File.cd!("pack")
File.ls!
|> IO.inspect
File.cwd!()
|> IO.inspect
File.cd!("../")
File.ls!
|> IO.inspect
File.exists?("missing.txt")
|> IO.inspect
File.exists?("Main.exs")
|> IO.inspect
{:ok, file} = File.open("exec_stdin.txt", [:read])
IO.read(file, :line)
|> IO.inspect
File.close(file)
File.open("exec_stdin.txt", [:read, :write], fn file ->
IO.read(file, :line)
|> IO.inspect
end)
実行結果
["pack", "main.tar.gz", "Main.exs", "runner_mysql", "exec_stdin.txt",
"run_user", "runner_php", "exec_stderr.txt", "exec_command", "exec_stdout.txt"]
[]
"/workspace/pack"
["pack", "main.tar.gz", "Main.exs", "runner_mysql", "exec_stdin.txt",
"run_user", "runner_php", "exec_stderr.txt", "exec_command", "exec_stdout.txt"]
false
true
"test"
"test"
成果物
以上。