First you should use a file:read_line/1line of text to read and use re:split/2to get a list of lines containing numbers. Then use list_to_integerBIF to get integers.
Here is an example (of course, there is a better solution):
%% -*- erlang -*-
main([Filename]) ->
{ok, Device} = file:open(Filename, [read]),
read_integers(Device).
read_integers(Device) ->
case file:read_line(Device) of
eof ->
ok;
{ok, Line} ->
% Strip the trailing \n (ASCII 10)
StrNumbers = re:split(string:strip(Line, right, 10), "\s+", [notempty]),
[N1, N2, N3, N4] = lists:map(fun erlang:list_to_integer/1,
lists:map(fun erlang:binary_to_list/1,
StrNumbers)),
io:format("~w~n", [{N1, N2, N3, N4}]),
read_integers(Device)
end.
(EDIT)
, io:fread . , , .
%% -*- erlang -*-
main([Filename]) ->
{ok, Device} = file:open(Filename, [read]),
io:format("~w~n", [read_integers(Device)]).
read_integers(Device) ->
read_integers(Device, []).
read_integers(Device, Acc) ->
case io:fread(Device, [], "~d~d~d~d") of
eof ->
lists:reverse(Acc);
{ok, [D1, D2, D3, D4]} ->
read_integers(Device, [{D1, D2, D3, D4} | Acc]);
{error, What} ->
io:format("io:fread error: ~w~n", [What]),
read_integers(Device, Acc)
end.