Skip to content

david-marin-0xff/cpp-hex-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

How to Build and Use cpp-hex-viewer

This project is a console-based hex viewer written in C++. It compiles into a native Windows executable and can read any file as raw hexadecimal bytes.

image

1️⃣ Requirements

  • Visual Studio Build Tools (MSVC)
  • Use x64 Native Tools Command Prompt for VS
  • No Qt, no GUI libraries, no CMake required

2️⃣ Open the Correct Terminal

⚠️ IMPORTANT
Always compile using:

Visual Studio 2026 x64 Native Tools Command Prompt

PowerShell alone will NOT work for compiling.


3️⃣ Go to the Project Folder

You must be inside the folder that contains main.cpp.

cd C:\Users\David\cpp-hex-viewer

Verify files exist:

dir

You should see:

  • main.cpp

4️⃣ Compile the Program

Run this command from inside the project folder:

cl /std:c++20 /EHsc main.cpp

This creates:

  • main.exe → the hex viewer program

You only need to compile again if you change the code.


5️⃣ How to Use the Program

General syntax:

main.exe <file_path>

The program prints the file contents as hexadecimal bytes.


Examples

Read a binary file:

main.exe test.bin

Read a text file:

main.exe notes.txt

Read an image:

main.exe image.png

Read a file in another folder (full path):

main.exe C:\Users\David\Downloads\file.bin

Read a file using a relative path:

main.exe ..\Downloads\file.bin

6️⃣ Important Notes

  • The program reads any file (text or binary)

  • The program does NOT modify files (read-only)

  • Compilation requires MSVC

  • Running main.exe works in any terminal

  • image

7️⃣ Common Mistakes to Avoid

❌ Running cl from PowerShell

✅ Compile once, reuse forever
✅ Pass any file path you want


8️⃣ Mental Model

  • cl main.cpp → builds the tool
  • main.exe file → uses the tool on any file

About

💻 Console-based hex viewer written in C++ 💻

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages