In the last lesson, you learned how to open a file. Now, let's learn how to read in some data contained in the file.
To read data from a file, you can used the file_read function, that works like this:
data=file_read(handle)
Move the mouse over a dotted box for more information.
Now you try. Run the code and see if you can read the first line of data from the file sample.dat.
Type your code here:
See your results here:
This code will not run! Fill in the file name in the file_open line, and what will you pass in to the file_read function?
If everything works, you should see a number appear on your screen, which is the first number in the file sample.dat.
Share your code
Show a friend, family member, or teacher what you've done!