BFOIT - Introduction to Computer Programming
Background
jLogo Programming
- Commanding a Turtle
- Pseudocode
- Adding New Commands
- Iteration & Animation
- Hierarchical Structure
- Procedure Inputs
- Operators & Expressions
- Defining Operators
- Words & Sentences
- User Interface Events
- What If? (Predicates)
- Recursion
- Local Variables
- Global Variables
- Word/Sentence Iteration
- Mastermind Project
- Turtles As Actors
- Arrays
- File Input/Output
Java
- A Java Program
- What's a Class?
- Extending Existing Classes
- Types
- Turtle Graphics
- Control Flow
- User Interface Events
Appendices
- Jargon
- What Is TG?
- TG Directives
- jLogo Primitives
- TG Editor
- Java Tables
- Example Programs
- *** New ***:
Installation Notes
Updates
- December 13, 2008
- January 6, 2012
- March 15, 2013
- January 20, 2014
- February 13, 2014
- July 29, 2014
- January 18, 2016
- January 29, 2016
- August 19, 2016
Lastly
File I/O
Introduction
It is not always possible to include all of the data you want your programs to manipulate within the source code of your programs.
In this lesson, you will learn:
- How a program can read text from a file,
- How to write text to a file.
Revisiting Our Hangman Game
File Input/Output Procedures
Name | Input(s) | Description |
CLOSE | fileObject | Wrapup input or output associated with the specified file object. |
OPENAPPEND | fileName | Outputs a file object that can be used to WRITE text onto the end of the specified fileName. |
OPENREAD | fileName | Outputs a file object that can be used to read lines of text from the specified fileName. |
OPENWRITE | fileName | Outputs a file object that can be used to WRITE text to the specified fileName. If the file already exists, its contents are overwritten. |
(READLIST) | fileObject | Outputs a line of text read from the fileObject. The line is parsed into word, list, and/or array members depending upon whitespace, brackets, parenthesis, and sqiggly braces. |
(READWORD) | fileObject | Outputs a line of text read from the fileObject. The full line including all whitespace and punctuation is represented as a word. |
WRITE | fileObject textData |
Write textData to the specified fileObject. |
WRITELN | fileObject textData |
Write textData followed by a line separator to the specified fileObject. | |
Summary
Go to the Table of Contents
On to A Java Program