1. Course
  2. Binary Files
  3. Hexadecimal viewer

Hexadecimal viewer


Last updated: 8/23/2020 Difficulty: Intermediate

Create a hexadecimal viewer in C# that shows the contents of a binary file on screen as follows:

  • 16 bytes per row
  • 24 rows on screen
 

The 16 bytes will be displayed first in hexadecimal and then as printable characters. You must also substitute bytes smaller than 32 (unprintable characters) with dots.

Display 24 rows of 16 bytes each time the user presses Enter.

Input

Output

00000000  4d 5a 90 00 03 00 00 00 04 00 00 00 ff ff 00 00 MZ?.........ÿÿ..
00000010  b8 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 ¸.......@.......
00000020  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000030  00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 00 ............?...
00000040  0e 1f ba 0e 00 b4 09 cd 21 b8 01 4c cd 21 54 68 ..º..´.Í!¸.LÍ!Th
00000050  69 73 20 70 72 6f 67 72 61 6d 20 63 61 6e 6e 6f is program canno
00000060  74 20 62 65 20 72 75 6e 20 69 6e 20 44 4f 53 20 t be run in DOS
00000070  6d 6f 64 65 2e 0d 0d 0a 24 00 00 00 00 00 00 00 mode....$.......
00000080  50 45 00 00 4c 01 03 00 b2 7c cd cf 00 00 00 00 PE..L...²|ÍÏ....
00000090  00 00 00 00 e0 00 22 00 0b 01 30 00 00 0a 00 00 ....à."...0.....
000000a0  00 08 00 00 00 00 00 00 66 28 00 00 00 20 00 00 ........f(... ..
000000b0  00 40 00 00 00 00 40 00 00 20 00 00 00 02 00 00 .@....@.. ......
000000c0  04 00 00 00 00 00 00 00 06 00 00 00 00 00 00 00 ................
000000d0  00 80 00 00 00 02 00 00 00 00 00 00 03 00 60 85 .?............`?
000000e0  00 00 10 00 00 10 00 00 00 00 10 00 00 10 00 00 ................
000000f0  00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 ................
00000100  13 28 00 00 4f 00 00 00 00 40 00 00 bc 05 00 00 .(..O....@..¼...
00000110  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000120  00 60 00 00 0c 00 00 00 6c 27 00 00 38 00 00 00 .`......l'..8...
00000130  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000140  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00000150  00 00 00 00 00 00 00 00 00 20 00 00 08 00 00 00 ......... ......
00000160  00 00 00 00 00 00 00 00 08 20 00 00 48 00 00 00 ......... ..H...
00000170  00 00 00 00 00 00 00 00 2e 74 65 78 74 00 00 00 .........text...

Solution

Binary Files

7 / 7

Android App


Practice C# anywhere with the free app for Android devices.

Android App

Exercises C# by difficulty


Learn C# at your own pace, the exercises are ordered by difficulty.

Make a donation


Your donations support our work and contribute to the maintenance of the app.

Advertising