You must create a program which loads the file observations.txt and creates a binary file of records containing the valid entries called valid.dat and a text file called errors.txt which contains the entries that do not follow the rules in the same format as the original text file. The records must have alignment padding disabled.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Hi ,please help ,the information below is the entire question.

File Handling in C++

The Utopian Astronomical Society (UAS) is collaborating with observatories all around the
world to gather a weeks worth of intensity observations of the same variable star which they
believe may be about to become a supernova.
The UAS has recently heard about the advantages of random access files of records and would
like you to create a program which will convert their old text based observation files into a new
binary format.

 

• Each line in the text file represents an observation data set, each datum is separated
by a space, the values are as follows in the order below:

 An observation ID in the following format: An observation ID starts with an
uppercase letter then contains any combination of upper case letters, numbers,
and hyphens “-“. The ID may not end on a hyphen. The maximum length is 16
characters.

 A valid ISO 8601 date (i.e. a date in the YYYY-MM-DD format).

 A sequence of up to 7 integer values in the range [0, 100]

 

Not all of the entries in this file will follow the rules.

 

You must create a program which loads the file observations.txt and creates a binary file
of records containing the valid entries called valid.dat and a text file called errors.txt
which contains the entries that do not follow the rules in the same format as the original text
file. The records must have alignment padding disabled.

 

output sample

I-978-213 2020-01-02 10 5 20 33 54 20
BV-123-433 2020-05-02 23 12 22 12 20
OP-VG3-712 2020-07-02 5 1 67 22
12-DF-11 2020-04-03 1 2 3 4
GH-I-12- 2020-08-12 2 29 83 99
JK-ILM-20 2020-99-12 1 2 3
JJ-GSM-20 2020-09-12 1 2 3 4 5 6 7 8
TT-JJJ-1983 1983-01-01 50 75 80 65 50

saved as  observation.txt

 

 

Expert Solution
steps

Step by step

Solved in 2 steps with 6 images

Blurred answer
Knowledge Booster
ADT and Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education