Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ CeditX Public

CeditX is a lightweight hex editor written in C, designed to explore and edit binary files through a simple command-line interface. It supports loading, saving, direct byte editing, and hex pattern search with safe memory management. The project is still under development, so bugs may be present.

Notifications You must be signed in to change notification settings

bosioF/CeditX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CeditX, a simple and lightweight hex editor made in C

A simple but complete hex editor written in C for educational purposes.

Features

  • 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

Requirements

To compile and run CeditX you need:

Linux (Ubuntu/Debian)

sudo apt update
sudo apt install build-essential make

macOS

xcode-select --install   # Installs gcc/clang and make

(or alternatively install GNU make with Homebrew: brew install make)

Windows

  1. Install MSYS2 (recommended) or MinGW-w64.

  2. With MSYS2, open the MSYS2 MinGW shell and install the tools:

    pacman -S mingw-w64-x86_64-gcc make
  3. Ensure gcc and make (or mingw32-make) are available in your PATH.


Installation

# Clone the repository
git clone https://github.com/bosioF/CeditX.git
cd CeditX

Compile with Makefile

A 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
  • WindowsCeditX.exe

Usage

Available commands

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

Practical examples

# 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
exit

Sample output

Offset   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.....

Code structure

Main files

  • src/main.c - Main source code
  • makefile - Build automation
  • README.md - This documentation

Key components

  • 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

Main functions

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

Current limitations

  • 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)

Next improvements

  • 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

About

CeditX is a lightweight hex editor written in C, designed to explore and edit binary files through a simple command-line interface. It supports loading, saving, direct byte editing, and hex pattern search with safe memory management. The project is still under development, so bugs may be present.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published