Created
August 14, 2012 15:28
-
-
Save oxling/3350274 to your computer and use it in GitHub Desktop.
Using io:fread with new process
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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