<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Thanks Lucas and Dan.  This solved my problem.<br>
    </p>
    <div class="moz-cite-prefix">On 12/18/2018 2:39 AM, Lukas Larsson
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAP3zBqP9X7aP15+qyJiKuTfU5de+-dt3mjHxjTco04AgoDtotw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div dir="ltr"><br>
          <br>
          <div class="gmail_quote">
            <div dir="ltr">On Tue, Dec 18, 2018 at 2:04 AM Donald Steven
              <<a href="mailto:t6sn7gt@aim.com"
                moz-do-not-send="true">t6sn7gt@aim.com</a>> wrote:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">Hi all,<br>
              <br>
              A newbie question (I've tried for hours to figure this
              out, but failed):<br>
              <br>
              I want to read a single character from a file, and have it
              return the <br>
              integer representation of the character.  I've used:<br>
              <br>
              <a class="moz-txt-link-freetext" href="file:open(Fname">file:open(Fname</a>, [read, raw, binary]) to open the file and<br>
              <a class="moz-txt-link-freetext" href="file:read(Fd,1)">file:read(Fd,1)</a> to retrieve a character.<br>
              <br>
              This works fine and I'll get back, for example
              <<"%">>, which is_binary <br>
              tells me is a binary.  I've tried
              binary_to_integer(<<"%">>) but I get a <br>
              badarg error.<br>
            </blockquote>
            <div><br>
            </div>
            <div>binary_to_integer converts the binary text
              representation of an integer to an integer, i.e.
              binary_to_integer(<<"123">>) -> 123.</div>
            <div><br>
            </div>
            <div>To get the integer value of a binary you can either use
              pattern matching as Dan suggestest:</div>
            <div> <br>
            </div>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px
              0.8ex;border-left:1px solid
              rgb(204,204,204);padding-left:1ex">
              <<Integer>> = Binary, Integer.<br>
            </blockquote>
            <div> </div>
            <div>or you can use
              binary:decode_unsigned(<<"%">>) -> 37.</div>
            <div><br>
            </div>
            <div>Lukas</div>
          </div>
        </div>
      </div>
    </blockquote>
  </body>
</html>