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.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.1: I/o File Stream Objects And Functions
Problem 9E
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
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr