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

Home » Public Forums » archive » Re: Read Total lines in an ASCII file
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: Read Total lines in an ASCII file [message #33174 is a reply to message #33172] Fri, 13 December 2002 10:08 Go to previous messageGo to previous message
David Burridge is currently offline  David Burridge
Messages: 33
Registered: January 1998
Member
Hi Maria,

Actually, I beleive there is a new feature in IDL 5.6 that does this. But
assuming you're still on IDL 5.5, something like:

noLines = 0L
line = ''
OpenR, lun, 'mytextfile.txt', /Get_lun
While Not EOF (lun) Do Begin
ReadF, lun, line
noLines = noLines + 1
EndWhile

Will do the trick. If (as I suspect) you then want to read the file, don't
forget to:

Point_Lun, lun, 0

before you do. Otherwise, you'll need a:

Free_Lun, lun

to close the file and make the allocated file unit available to IDL again.

On the other point, will a simple:

mychar EQ 'P'

in a statement do the trick? Examples

If mychar EQ 'P' Then Print, 'Hello'

mybool = mychar EQ 'P'

Hope this helps.

Best regards,

David




David Burridge

Burridge Computing

18 The Green South

Warborough

Oxon

OX10 7DN



Tel: 01865 858279

Mobile: 0780 244 1748

Email: davidb@burridgecomputing.co.uk


"Maria" <msmimb@hotmail.com> wrote in message
news:d19b702e.0212130942.1d6d6dbf@posting.google.com...
> I bet my question seems simple to all of you but...does anybody know
> how to read the total number of lines in an ASCII file?
>
> Also, is there any command in IDL such as if ( variable_char is char)
> then give me a boolean (true or false)?
>
> Thanks a lot!
> Maria.


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.404 / Virus Database: 228 - Release Date: 15/10/2002
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Histogram indeterminate results
Next Topic: handling numbers

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

Current Time: Sun Oct 12 00:40:23 PDT 2025

Total time taken to generate the page: 0.32283 seconds