A simple but complete hex editor written in C for educational purposes.
- Hexadecimal visualization with ASCII representation
- Loading and saving binary files
- Direct byte editing
- Hexadecimal pattern search
- Intuitive command-line interface
- Safe memory management with bounds checking
- Support for files up to 1MB
To compile and run CeditX you need:
sudo apt update
sudo apt install build-essential makexcode-select --install # Installs gcc/clang and make(or alternatively install GNU make with Homebrew: brew install make)
-
With MSYS2, open the MSYS2 MinGW shell and install the tools:
pacman -S mingw-w64-x86_64-gcc make
-
Ensure
gccandmake(ormingw32-make) are available in your PATH.
# Clone the repository
git clone https://github.com/bosioF/CeditX.git
cd CeditXA Makefile is provided for cross-platform builds.
-
On Linux/macOS:
make # compile make run # compile and run make clean # remove build files
-
On Windows (MSYS2/MinGW):
mingw32-make # compile mingw32-make run # compile and run mingw32-make clean # remove build files
The resulting executable will be:
- Linux/macOS →
./CeditX - Windows →
CeditX.exe
| Command | Syntax | Description |
|---|---|---|
load |
load <filename> |
Load a binary file |
save |
save [filename] |
Save file (optionally with new name) |
view |
view [offset] [lines] |
Display content in hex format |
edit |
edit <offset> <hex_value> |
Modify a specific byte |
search |
search <hex_pattern> |
Search for a hexadecimal pattern |
info |
info |
Show current file information |
help |
help |
Show command menu |
exit |
exit or quit |
Exit the program |
# Start the program
./CeditX
# Load a file
load myfile.bin
# Display first 10 lines
view 0 10
# Display from byte 256 onwards
view 0x100 5
# Modify byte at offset 32 with value FF
edit 0x20 FF
# Search for pattern "DEADBEEF"
search DEADBEEF
# Save changes
save
# Save with new name
save modified_file.bin
# Exit program
exitOffset 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ASCII
-------- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------
00000000 48 65 6C 6C 6F 20 57 6F 72 6C 64 21 0A 00 FF AA Hello World!....
00000010 DE AD BE EF CA FE BA BE 01 23 45 67 89 AB CD EF ........#Eg.....
src/main.c- Main source codemakefile- Build automationREADME.md- This documentation
- HexBuffer: Data structure that manages the file in memory
- File I/O: Functions for binary loading and saving
- Display: Formatted visualization in hex + ASCII
- Command Parser: Interactive command interpreter
- Memory Management: Safe allocation and deallocation
HexBuffer* hex_buffer_init(const char *filename); // Initialization
int hex_buffer_load(HexBuffer *buffer, const char *filename); // Loading
int hex_buffer_save(HexBuffer *buffer, const char *filename); // Saving
void hex_display(HexBuffer *buffer, size_t offset, size_t lines); // Display
int hex_edit_byte(HexBuffer *buffer, size_t offset, unsigned char value); // Edit
void hex_search(HexBuffer *buffer, const char *hex_string); // Search- Maximum file size: 1MB (defined by
MAX_BUFFER_SIZE) - Complete loading in memory (no streaming)
- Text-only interface
- No undo/redo of modifications
- Simple search (no regex or complex patterns)
- Support for large files (streaming)
- Graphical interface with ncurses
- Modification history (redo)
- Advanced search with regex
- Multiple display modes (8/16/32 bit)
- Support for different encodings
- Plugin system for specific formats