[erlang-questions] binary_to_integer badarg

Donald Steven t6sn7gt@REDACTED
Tue Dec 18 02:04:30 CET 2018


Hi all,

A newbie question (I've tried for hours to figure this out, but failed):

I want to read a single character from a file, and have it return the 
integer representation of the character.  I've used:

file:open(Fname, [read, raw, binary]) to open the file and
file:read(Fd,1) to retrieve a character.

This works fine and I'll get back, for example <<"%">>, which is_binary 
tells me is a binary.  I've tried binary_to_integer(<<"%">>) but I get a 
badarg error.

Your help would be greatly appreciated.  Thanks.

Don



More information about the erlang-questions mailing list