From the course: Learning Assembly Language

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Reading data files

Reading data files - Python Tutorial

From the course: Learning Assembly Language

Start my 1-month free trial

Reading data files

- [Instructor] We've used the console as a form of input and output, but let's take a look at how we work with data files. I've prepared a file called ode.txt. From the first verse of Thomas Gray's, "Ode on a Favorite Cat Drowned in a Bowl of Goldfish". Let's see how we read this. I've created a program to read it and display it in both ASCII and Hex. So let's take a look through it. We start with a constant section, which creates attribute names for the file management attributes we're using. And see, these are normally included in the .H files, which we could set up and use in the project. However, as there's just a few of them, we'll include them here. Lines nine to 14, have the various console and file handles and byte returned fields we'll need. Line 16 to 21 have the various string and output line buffers we'll be using. After our standard entry code, we have a small callable routine called hexed, which will…

Contents