Programming Essay

4028 words - 16 pages

1
1
File Input/Output
2
Objectives
- To be able to create, read, write and update
files.
- To become familiar with sequential access file
processing.
- To become familiar with random-access file
processing.
3
Introduction
• Information to be written to or from an
auxillary memory device
• This information is stored on the memory
device in the form of a data file
• C++ does not distinguish between sequential
and direct access (random access) data files.
• There are 2 types of data files, called stream-
oriented (or standard) data files and system-
oriented (or low-level) data files.

2
4
Introduction
• Data files
- Can be created, updated, and processed by
C++ programs
- Are used for permanent storage of large
amounts of data
• Storage of data in variables and arrays is only
temporary
5
The Data Hierarchy
• Data Hierarchy:
- Bit - smallest data item
• Value of 0 or 1
- Byte - 8 bits
• Used to store a character
- Decimal digits, letters, and special symbols
- Field - group of characters conveying meaning
• Example: your name
- Record - group of related fields
• Represented by a struct or a class
• Example: In a payroll system, a record for a particular
employee that contained his/her identification number,
name, address, etc.
6
The Data Hierarchy
• Data Hierarchy (continued):
- File - group of related records
• Example: payroll file
- Database - group of related files

3
7
The Data Hierarchy
• Data files
- Record key
• Identifies a record to facilitate the retrieval of
specific records from a file
- Sequential file
• Records typically sorted by key
8
Files and Streams
• C views each file as a sequence of bytes
- File ends with the end-of-file marker
• Or, file ends at a specified byte
• Stream created when a file is opened
- Provide communication channel between files
and programs
- Opening a file returns a pointer to a FILE
structure
• Example file pointers:
• stdin - standard input (keyboard)
• stdout - standard output (screen)
• stderr - standard error (screen)
9
Files and Streams

4
10
Categories
• Stream-oriented data files can be divided
into 2 categories:
• (i) Text files
• (ii) Unformatted data files
11
Text files
• Text files consist of consecutive
characters. These characters can be
interpreted as individual data items, or as
components of strings or numbers.
12
Unformatted
• Unformatted data files organizes data into
blocks containing contiguous bytes of
information. These blocks represent more
complex data structures such as arrays &
structures.

5
13
System-oriented
• System-oriented data files are more
closely related to the computer's operating
system than stream-oriented data files.
14
Opening a file
• The first step when working with a stream- oriented data file is to establish a buffer area where info is temporarily stored while being transferred between the computer's...

Find Another Essay On Programming

Pascal Programming Essay

1444 words - 6 pages Pascal programming language was designed in 1968, and published in 1970. It is a small and efficient language intended to encourage good programming practices using structured programming and data structuring. Pascal was developed by Niklaus Wirth. The language was named in honor of the French mathematician and philosopher Blaise Pascal. In 1641, Pascal created the first arithmetical machine. Some say it was the first computer. Wirth improved

Programming experience Essay

1027 words - 5 pages I have been programming in C/C++ for six years, including bachelor degree tenure. During the academic years, the degree curriculum covered many courses which involved C/C++ programming such as Introduction to Programming in C, Data Structures, Object Orient Programming, System Programming, Computer Graphics, etc. Some of these courses included C/C++ projects as an essential part of the course. In Data Structures, our team of two students had

Computer programming

1304 words - 5 pages variety of other specialized workers. Computer programming is one of the main computer professions in the world today. Computer programmer write, test, and maintain computer programs or software. Programmers are often categorized as technicians because of the work they do. Many programmers are involved in updating, repairing, modifying and expanding existing programs. They are often grouped into two types. These two types are Applications

Computer Programming

667 words - 3 pages , networked systems and database systems. The stereotype of computer programmers being "nerds", is in fact generally true. Although some work may be in correlation with other people, most programming can be done solo. Most programmers sit typing furiously hunched over a computer screen for 5-7 hours a day. This, unfortunately can lead to severe health problems. An unergonomically designed workspace can lead to carpal tunnel syndrome in wrists

PHP Programming

333 words - 2 pages Hello, And Welcome To The Wonderful World Of PHP Programming! PHP (Hypertect Preprocessor) Is A Quite Easy Language To Write, After You Get To Know What You Are Doing, Just Like Everything In Life! Here Are Some Simple Scripts To Help To Get You On Your Way To Mastering The Language!The Following Code Will Display The Word 'hello' On Your Page!echo"hello";?>You May Also Want To Spice This Code Up A Bit With Some HTML(Hypertext Markup Language

Television programming

2209 words - 9 pages IntroductionReality programming broadcasts crime dramatizations or film footage of police and other emergency personnel at work as regular television series.Two of the earliest and most successful reality programs, "America's Most Wanted" (AMW) and "Unsolved Mysteries" (UM), present a series of vignettes in which the participants or actors reenact actual crimes. The vignettes feature interviews with victims, their family and friends, the police

Port Programming

1941 words - 8 pages Directions: Here are some ideas I'm going to implement in the next releases: * Trapping interrupts - PORT will trap and display any hardware interrupts it detects on specified lines.* Programming constructs for the command language. To allow one to program a test sequence with basic decision constructs.* A data register stack. Allows one to store away port or byte data for later use.* Command stack with recall. Probably something similar to the

Computer Technology, programming

635 words - 3 pages Programming a computer is almost as easy as using one and does not require you to be a math genius. People who are good at solving story problems make good programmers, and others say that artistic or musical talent is a sign of potential programmer. Various computer languages are described, and tips on choosing the right language and learning how to use it are provided.Learning how to program is actually easier than many people think. Learning

Computer Programming Languages: Fortran

1295 words - 5 pages Fortran is one of the thousands of different programming languages. A programming language is a set of grammatical rules or guidelines for a compiler to follow. A compiler is a program that converts a programming language into what is called the object code, which is usually binary. Object code is code that the computer or program can understand. Basically, programming languages are for us to be able to create programs and control a computer in

History of Programming Languages

1667 words - 7 pages I. Introduction The topic that I have chosen and researching about is an in-depth look into the history of computer programming languages. I chose this topic as a pathway for me to learn about them, and how they are applied to assist the real world. This topic relates to my life interest to become a computer programmer, to help others in the creation of new technology. Without them, what would power or provide the special features for our

Why parallel programming?

1044 words - 5 pages increase the temperature of the chips. To resolve the problem the design engineers changed the design of the microprocessors and used the parallelism i.e increasing the number of cores in a chip. Following the changes of the microprocessors design to parallelism, to take full advantage of multi core processors, this necessitated software developers to write parallel software. Peter S.Pacheco in his book, An Introduction to Parallel Programming

Similar Essays

Simply Programming Essay

851 words - 4 pages There are many differences between Procedural programming, and Object-Oriented programming; this is also very true when considering there likeness, and usability. Both programming languages use some type of data to either create a direction, or an object. However, in this essay the main focus will be to consider the difference between the two languages. This will be conducted through a brief example of both programming types, and further

Programming Languages Essay

955 words - 4 pages Introduction There is a plethora of different development programming languages, known as paradigms, available to a software designer. I intend to explore some of these models and discuss why a developer would choose one over another to accomplish a specific task. Object oriented programming. This is a self-contained, yet abstract programming language, which is easy to maintain. There are many advantages of object-oriented programming

Extreme Programming Essay

1223 words - 5 pages Extreme Programming Upon reading the word, extreme; it is not uncommon to take a step back and consider what that actually means; including the severity it may imply. Severity is no stranger to Extreme Programming, which aims to streamline the software development process in some radical ways. Some of the methods this style of development implements include: pair programming, test-driven development, simple design, customer tests

Computer Programming Essay

1557 words - 7 pages How could you be reading this paper right now without programs like Windows and Word that this was made on? Technology has become an important part of our everyday lives, meaning the people who program it have important jobs. In order to become and remain a computer programmer, a student should go to college to get a degree. Computer programming is a difficult yet rewarding career. Programmers use different programming languages in their day