user the name of a binary or text file and a desired one Queries the number of bytes and then outputs this number of bytes from the file. ->The content of ten bytes in each line should first be output in hexadecimal and then decoded according to the ASCII table. For the ASCII string, make sure that the control characters in the file do not interfere with the formatting of the output. In the examples below, for example, a Tabulator as '¬' (\ xaa) and a line break as '╗' (\ xbb). -> The program should differentiate between binary and text files based on the file extension .txt. -> Functionality and required formatting can be seen in the two following examples.

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

C++:HexDump: Hello i need help with this task:

I need a working code.

Write a program that gives the user the name of a binary or text file and a desired one Queries the number of bytes and then outputs this number of bytes from the file.
->The content of ten bytes in each line should first be output in hexadecimal and then decoded according to the ASCII table. For the ASCII string, make sure that the control characters in the file do not interfere with the formatting of the output. In the examples below, for example, a Tabulator as '¬' (\ xaa) and a line break as '╗' (\ xbb).
-> The program should differentiate between binary and text files based on the file extension .txt.
-> Functionality and required formatting can be seen in the two following examples.

 

tabeltennis.dta

TSV Auerbach  @ V   TV Buerstadt  X :   SV Crumstadt II  l $ $ TSV Ernsthofen  D S   TSV Hoechst II  [ 0   TTC Langen-Brombach  < ^  SV Moerlenbach II  5 Z  DJK/Scc Pfungstadt  O N   TV Seeheim   e  TV Stockheim  W 6 

 

 

 

buildings.txt

"64846 Gross-Zimmern Waldstr. 5" 1600000 25000 1 "Waldhotel" ***
"64846 Gross-Zimmern Holzstr. 25" 10000000 4000000 2 2000 20
"48163 Muenster Untietheide 2" 1200000 45000 1 "Landhaus Kahl" ****
"70567 Stuttgart Richterstr. 23" 1000000 15000 1 "Hotel Koerschtal" ***
"64807 Dieburg Lagerstr. 3" 5000000 2100000 2 1500 24
"64807 Dieburg Zuckerstr. 3" 6000000 3100000 2 1900 33
"64807 Dieburg Markt 22" 1200000 23000 1 "Mainzer Hof" ***
"64295 Darmstadt Rheinstr. 105" 3300000 63000 1 "Maritim" *****
"64295 Darmstadt Rheinstr. 75" 5000000 2700000 2 1200 36
"64293 Darmstadt Bleichstr. 48" 9000000 23000 1 "Prinz Heinrich" **
"64293 Darmstadt Kasinostr. 48" 9500000 23000 2 1200 23
"64846 Gross-Zimmern Stadtstr. 3" 1400000 25000 1 "Stadthotel" ***
"64846 Gross-Zimmern Holzweg 42" 8000000 4000000 2 1800 22
"48163 Muenster Bahnhofstr. 27" 1800000 16000 1 "Zum Bahnhof" **
"70567 Stuttgart Henkerstr. 16" 1100000 15000 1 "Hotel Kirschbluete" ***
"64807 Dieburg Industriestr. 23" 5000000 210000 2 1230 21
"64807 Dieburg Salzstr. 36" 7000000 3100000 2 1950 31
"64807 Dieburg Markt 22" 1300000 23000 1 "Schwarzer Loewe" ***
"64295 Darmstadt Rheinstr. 98" 3800000 63000 1 "Maritim Kongress" *****
"64295 Darmstadt Rhausstr. 110" 8500000 2700000 2 1800 34
"64293 Darmstadt Heinerstr. 78" 8500000 23000 1 "Kaiserhof" ****
"64293 Darmstadt Kasinostr. 56" 7500000 23000 2 1100 30
"64846 Gross-Zimmern Pilsweg 108" 7500000 4000000 2 2200 23

Name der Datei: tabletennis.dta
Wieviele Bytes aus 'tabletennis.dta' sollen ausgegeben wer-
den: 105
54
53
56
20
41 75 65 72 62 61
TSV Auerba
00 00 00 00 00 00
00 00 00 56 00
00
63
68
00
00
ch
12
00
00
00
40
e v
00
00
OE
00
00 16 00 00 00
54
56
20
42
75
65 72 73 74
61
TV Buersta
00 00 00 00 00
00 00 ЗА 0
00 OF 00 00 00
61
64
74
00
00
00
dt
12
00
00
00
58
00
х:
00
00
15
00
00
53
56
20
43
72
75
6D 73 74
sv Crumsta
64
74
20
49
49
00 00 00 00 00
dt II
00
00
00
1 1
12
6C
Name der Datei: buildings.txt
Wieviele Bytes aus 'buildings.txt' sollen ausgegeben werden:
120
22
36
34
38
34
36 20 47 72
6F
"64846 Gro
73
73
2D
5A
69
6D
6D
65 72 6E
ss-Zimmern
20
57
61
6C
64
73
74
72 2E 20
Waldstr.
35
22
09
31
36
30
30
30
30
30
5"¬1600000
09
32
35
30
30
30
09
31
09
22
-25000¬1¬"
57
61
6C
64
68
6F
74
65
6C 22
Waldhotel"
6484 " ך***-
6 Gross-Zi
09
2A
2A
2A
OA
22 36 34 38 34
36
20
47
72
6F
73
73
2D
5A
69
6D
6D
65
72
6E
20
48
6F
6C
7A
mmern Holz
73
74
72
2E
20
32
35
22
09
31
str. 25"¬l
30
30
30
30
30
30
30
09
34
30
0000000-40
30
30
30
30
30
09
32
09
32
30
00000-2¬20
Transcribed Image Text:Name der Datei: tabletennis.dta Wieviele Bytes aus 'tabletennis.dta' sollen ausgegeben wer- den: 105 54 53 56 20 41 75 65 72 62 61 TSV Auerba 00 00 00 00 00 00 00 00 00 56 00 00 63 68 00 00 ch 12 00 00 00 40 e v 00 00 OE 00 00 16 00 00 00 54 56 20 42 75 65 72 73 74 61 TV Buersta 00 00 00 00 00 00 00 ЗА 0 00 OF 00 00 00 61 64 74 00 00 00 dt 12 00 00 00 58 00 х: 00 00 15 00 00 53 56 20 43 72 75 6D 73 74 sv Crumsta 64 74 20 49 49 00 00 00 00 00 dt II 00 00 00 1 1 12 6C Name der Datei: buildings.txt Wieviele Bytes aus 'buildings.txt' sollen ausgegeben werden: 120 22 36 34 38 34 36 20 47 72 6F "64846 Gro 73 73 2D 5A 69 6D 6D 65 72 6E ss-Zimmern 20 57 61 6C 64 73 74 72 2E 20 Waldstr. 35 22 09 31 36 30 30 30 30 30 5"¬1600000 09 32 35 30 30 30 09 31 09 22 -25000¬1¬" 57 61 6C 64 68 6F 74 65 6C 22 Waldhotel" 6484 " ך***- 6 Gross-Zi 09 2A 2A 2A OA 22 36 34 38 34 36 20 47 72 6F 73 73 2D 5A 69 6D 6D 65 72 6E 20 48 6F 6C 7A mmern Holz 73 74 72 2E 20 32 35 22 09 31 str. 25"¬l 30 30 30 30 30 30 30 09 34 30 0000000-40 30 30 30 30 30 09 32 09 32 30 00000-2¬20
Expert Solution
steps

Step by step

Solved in 2 steps with 9 images

Blurred answer
Knowledge Booster
File Input and Output Operations
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