Created
April 19, 2016 01:21
-
-
Save eiri/83c3a70ac15c6eb54cf707d7cf8514d4 to your computer and use it in GitHub Desktop.
Write and read in ram file in erlang
This file contains hidden or 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(mardear). | |
-export([readram/0]). | |
readram() -> | |
{ok, Fd} = file:open([], [ram, write, read]), | |
IoData = io_lib:format("~s", [[$r, $a, $m]]), | |
ok = file:write(Fd, IoData), | |
{ok, Str} = file:pread(Fd, 0, 8192), | |
ok = file:close(Fd), | |
Str. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment