Shop OBEX P1 Docs P2 Docs Learn Events
Help please ... convert byte to long — Parallax Forums

Help please ... convert byte to long

PaulFPaulF Posts: 62
edited 2008-12-07 18:09 in Propeller 1
Hi all,
i am having great difficulty with this little matter. I am reading a byte from a file. This byte needs to be converted to a long to allow further calculations. Is there a simple way to convert from byte to long?
Any assistance is greatly appreciated.

Paul

Comments

  • T ChapT Chap Posts: 4,223
    edited 2008-12-07 18:04
    You would have to have a variable initialized as a long to start with to receive the byte. The simplest is to take your byte, and make the long equal = byte.

    longvar := bytevar

    You can't 'convert' a byte to long if the byte is initialized as a byte. You could just use a long in the first place though, then it is already a long, no conversion needed.
  • PaulFPaulF Posts: 62
    edited 2008-12-07 18:09
    Thanks TChapman,
    that works. It's been a very long day and \i must be getting tired.
Sign In or Register to comment.