LoginSignup
1
0

More than 1 year has passed since last update.

paiza.ioでelixir その123

Posted at

概要

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"

成果物

以上。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0