Skip to content

Instantly share code, notes, and snippets.

@oxling
Created August 14, 2012 15:28
Show Gist options
  • Save oxling/3350274 to your computer and use it in GitHub Desktop.
Save oxling/3350274 to your computer and use it in GitHub Desktop.
Using io:fread with new process
-module(iotest).
-compile(export_all).
% io:fread works as expected.
works() ->
io:format("Reading from console...\n"),
{ok, [Name]} = io:fread("What is your name?> ", "~s"),
io:format("Hello, ~s!\n", [Name]).
% Attempting io:fread on a new process has no effect.
doesnt_work() ->
spawn(?MODULE, works, []).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment