X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 18 Nov 2009 05:12 AM by  anon
Easy Problem with ASCII reader
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
18 Nov 2009 05:12 AM
    Hi. I wanna that my ASCII_reader can read Both STRING that INTEGER. If I want to read a .txt file with only numbers, like this example, 1 2 3 4 5 6 7 8 I can do pro READ textName=DIALOGPICKFILE(); n=FILE_LINES(textName) value = INTARR(n) openr, lun0, textname , /get_lun readf,lun0,value free_lun, lun0 END It works, but if i wanna modify the .txt file with a string, like Band 1 2 3 4 5 6 7 The program don't works and give me a conversion type Error. I tried to change INTARR to BYTARR or STRARR, but it don't works. Anyone can help me? Thanks

    Deleted User



    New Member


    Posts:
    New Member


    --
    20 Nov 2009 04:57 PM
    Hi Popi, Well, if your data input file is a mix of strings and numbers then you will need to do following: 1- open the file for reading using OPENR 2- specify that the text "Band" is a string, i.e. bandname='' 3- READF, lun0, bandname, value1, value2, format='(a5, i1,i1)' 4- try to see the results by using the command: HELP, bandname, value1 5- close the file: free_lun, lun   I hope this helps. Cheers, Fernando
    You are not authorized to post a reply.