[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

simple question about bytes



Hi,

I want to check if a line in an ascii file starts with a number or
character. My idea was to read the first character and convert it to
"byte" and check if its in or out the range of '48b' and '58b'. The code
example is :

    ; check for header
    header=''
    readf, lun, header
    firstchar=strmid(header,0,1)
    first_byte=byte(firstchar)

    no_head=0
    head_index=0
    WHILE ((first_byte LT 48b) AND (first_byte GT 57b)) DO BEGIN
         readf, lun, header       ; reads next line
         head_index=head_index+1  ; counts header lines
         no_header =head_index
    ENDWHILE
...

it compiles fine but on runtime I get the errormessage :

    Expression must be a scalar in this context: <BYTE      Array(1)>

How can I change the variable 'first_byte' from byte array to a byte
scalar ?

Or any other hint for a solution would be great!

Thank's

Gerhard