Abstract

This chapter shows how to read text data (formatted or ASCII data) from the terminal or a file. It chapter covers the basics of reading text (ASCII) output from the terminal or a file. Text (ASCII) files have advantages and disadvantages as a means of storing data. The primary advantage of text files is that they are human readable (with a text editor). Additionally, a text editor can be used to create a text file to be read by the computer program. Finally, text files are relatively portable, and can be moved from one computer to another with little difficulty. The major disadvantages of text files are that input and output are slow relative to binary files (this is important for large files) and the transformation from internal binary numbers to formatted text characters and back to binary numbers is not exact. Interactive Data Language (IDL) usually handles simple cases with sensible default behavior. Some points to remember in this chapter are: READ reads input from the terminal, READF reads from a file. A file must be opened before reading anything from it. When reading is finished the files must be closed. Reading from and writing to the same file should be avoided. The /GET_LUN keyword should be used with the OPENR command and the FREE_LUN command to avoid having to provide logical unit numbers. Free-form and formatted (ASCII) output are for humans to read. They are a bad way to transfer data between programs. When writing data for computers to read, binary formats should be used.

Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call