comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » simple question about bytes
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: simple question about bytes [message #17076 is a reply to message #16986] Fri, 03 September 1999 00:00 Go to previous messageGo to previous message
R.Bauer is currently offline  R.Bauer
Messages: 1424
Registered: November 1998
Senior Member
rappold wrote:

> 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
> ...

You have to use the first index type e.g.

WHILE ((first_byte[0] LT 48b) AND (first_byte[0] GT 57b)) DO BEGIN

you can declare header as bytarr with one element

header=bytarr(1)
readf, lun, header
first_byte=header[0]


R.Bauer
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: directing control after program interruption
Next Topic: runtime IDL, blocking widgets

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 08:03:44 PDT 2025

Total time taken to generate the page: 2.07774 seconds