🛡️ ByteC v1.1.0

ByteC Documentation

ByteC configures a C and C++ programming station directly on Android using native Termux. It installs in one command and takes ~120MB of storage. It requires no proot Linux container.

First time opening Termux? Follow the First Time Termux Setup below before running the command.

1-Click Installation

Open Termux and paste this command:

bash
curl -sL https://raw.githubusercontent.com/0xOpCode/ByteC/main/install.sh | bash

When the installation completes, reload your shell:

bash
source ~/.bashrc

Why ByteC Exists

College C programming courses assume every student owns a laptop. Many students code on smartphones. Running full Linux distributions like Ubuntu via proot consumes 3GB to 5GB of storage, runs sluggishly on budget chips, and burns battery quickly.

College Problem Standard Fix ByteC Solution
No laptop / Low storage Proot Ubuntu (needs 3-5GB) Native Termux (~120MB)
gcc: command not found Manual clang flag setup Smart gcc & g++ wrappers
Phone keyboard lacks { } ; " Switching keyboard layouts Ergonomic 2-row touch key bar
Code lost on Termux uninstall Lost progress Auto-linked to /sdcard/C_Projects
Lab manual code syntax Copying boilerplate manually 10 built-in university DSA templates

First Time Termux Setup

If you have never used Termux before, follow these steps in order.

Do not install Termux from Google Play Store. The Play Store build stopped receiving updates in 2020 due to Google SDK policy changes. Running pkg install on the Play Store build will fail with repository errors. Always install Termux from F-Droid or GitHub Releases.

1 Install Termux from F-Droid

Download the official APK from F-Droid: f-droid.org/packages/com.termux. Install the APK and launch Termux.

2 Grant Storage Access

Run this command inside Termux:

bash
termux-setup-storage

Android will show a popup asking for permission. Tap Allow. This lets ByteC save your programs to your phone's main storage so your files remain safe even if you uninstall Termux.

3 Run the 1-Click Installer

Copy the installer command and paste it into Termux:

bash
curl -sL https://raw.githubusercontent.com/0xOpCode/ByteC/main/install.sh | bash

To paste in Termux: long press anywhere on the black terminal screen and tap PASTE. Then press Enter on your keyboard.

4 Reload Shell

When the installer completes, type:

bash
source ~/.bashrc

You will see the ByteC banner and a 2-row touch toolbar with arrows and programming symbols above your keyboard.

Creating Programs (cnew)

The cnew command creates a clean C or C++ file with standard headers and opens it directly in Neovim.

bash
cnew lab1.c
cnew test.cpp

If you run cnew without arguments, it asks for a filename so you do not need to retype the command on mobile touch keyboards.

Using Built-In Lab Templates

College courses follow standard data structures assignments. You can start with full, tested implementations using the -t flag:

bash
cnew lab2.c -t linkedlist
cnew lab3.c -t stack
cnew lab4.c -t sort

Compiling & Running (crun)

In standard Linux, running a C program requires two commands: clang file.c -o file followed by ./file. ByteC combines this into one command and measures compile and runtime in milliseconds.

bash
crun lab1.c

Automating Program Input (scanf)

Typing inputs every time you test a program gets slow. Create a text file with your test inputs (for example input.txt) and pass it to crun with -i:

bash
crun lab1.c -i input.txt

Passing Command Line Arguments

bash
crun lab1.c 10 20 "test"

Student Error Tips

When code fails to compile, crun inspects compiler output and prints tips for common mistakes, such as missing semicolons, undeclared variables, or missing header files.

Neovim Survival Guide

ByteC bundles a pre-configured Neovim IDE setup (0xOpCode/nvim). If you have never used Vim or Neovim before, learn these core rules to avoid getting stuck.

Neovim uses modes: When you open a file, you are in Normal Mode. Pressing keyboard letters runs editor commands, not text insertion. Press i to enter Insert Mode and start typing code. Press Esc to return to Normal Mode.

Action Shortcut What it does
Run program <Space> + r Saves, auto-formats in Allman style, compiles, and runs in full screen
Start typing i Switches to Insert Mode so keyboard keys type characters
Stop typing ESC Returns to Normal Mode
Save file Ctrl + s Saves and formats current file
Save & Quit :wq + Enter Writes changes to storage and closes editor
Quit without saving :q! + Enter Discards edits and returns to terminal
Undo / Redo Ctrl + z / Ctrl + y Undoes or redoes last edit
Terminal overlay Ctrl + ~ or Ctrl + j Toggles a floating shell terminal inside editor
File browser <Space> + e Toggles sidebar file directory tree

Touch Navigation Bar

ByteC configures a custom 2-row toolbar directly above your phone's on-screen keyboard:

Touch Row Layout
Row 1: [ ESC   | TAB  | CTRL | ALT | { | } | ( | ) ]
Row 2: [ LEFT  | DOWN | UP   | RIGHT | " | ; | / | - ]

Use the arrow keys (LEFT, DOWN, UP, RIGHT) to move your cursor without fighting phone touch selection. Tap { } ( ) ; " directly without switching mobile keyboard sub-panels.

DSA & Lab Templates

ByteC includes 10 university C lab templates with standard comments and interactive menu loops:

Template Name Command Covers
hello cnew lab.c -t hello Main function, argument counting, basic printing
linkedlist cnew lab.c -t linkedlist Node creation, insertion at end, node deletion, memory free
stack cnew lab.c -t stack Push, pop, peek, overflow, and underflow handling
queue cnew lab.c -t queue Circular queue enqueue, dequeue, empty/full checks
binarytree cnew lab.c -t binarytree Binary Search Tree insertion, search, in/pre/post traversals
sort cnew lab.c -t sort Bubble sort, Selection sort, Insertion sort
matrix cnew lab.c -t matrix 2D Array addition and matrix multiplication
fileio cnew lab.c -t fileio File open, line-by-line reading, file writing
pointers cnew lab.c -t pointers Pass by reference, dynamic arrays with malloc and free
strings cnew lab.c -t strings String length, copy, compare, reverse without string.h

Multi-File Projects (cbuild)

When assignments grow beyond one file, run cbuild to compile all source files in your current folder:

bash
cbuild

This finds every .c or .cpp file, compiles with -Wall -Wextra -O2 -lm, and produces an executable named app. Run it with ./app.

To compile specific files to a custom binary:

bash
cbuild main.c utils.c -o mygame
cbuild clean   # Deletes *.out, *.o, and app binaries

Code Formatting (cformat)

Format source code in-place with college Allman bracket formatting:

bash
cformat lab1.c
cformat --all               # Formats all files in folder
cformat -s google lab1.c    # Formats with Google style

Guided Debugging (cdebug)

Debugging with raw GDB confuses beginners. The cdebug command compiles your code with debug symbols (-g -O0), prints an interactive cheat sheet, and launches GDB:

bash
cdebug lab1.c

Quick GDB Commands

  • b main - Breakpoint at main function
  • r - Run program
  • n - Step to next line
  • p myvar - Print value of variable
  • bt - Backtrace stack on segmentation faults
  • q - Quit debugger

Automated Lab Testing (ctest)

Verify your solution against test cases before submitting lab work.

Create a file named test.txt with this format:

test.txt
--- INPUT ---
10 20
--- EXPECTED ---
30

Run the test:

bash
ctest lab1.c test.txt

If the output matches, ctest prints green confirmation. If output differs, it displays expected output vs actual output with line differences.

ByteC Manager Commands

System Health Check (bytec doctor)

Audits installed compilers, storage links, git setup, and disk space. Suggests exact commands for any missing tools.

bash
bytec doctor

Configure Git Identity (bytec git)

Inspect or update your Git author name and email address with an interactive prompt:

bash
bytec git

Offline C Cheatsheet (bytec cheatsheet)

bash
bytec cheatsheet printf
bytec cheatsheet pointers
bytec cheatsheet strings
bytec cheatsheet loops
bytec cheatsheet dsa

Share Code via Link (bytec share)

Uploads your C file to a secure paste service and copies the link to your Android clipboard:

bash
bytec share lab1.c

Backup to Phone Storage (bytec backup)

Archives all code inside ~/c_projects into a compressed archive inside /sdcard/Download/:

bash
bytec backup

Codebase Statistics (bytec stats)

bash
bytec stats

Common Doubts & FAQ

1. Where are my files stored on my phone?

Your programs live in ~/c_projects. This directory links to /sdcard/C_Projects. You can open any Android file manager app (Google Files, Solid Explorer, ZArchiver) and view your .c files inside your phone's internal storage.

2. My keyboard disappeared in Termux. How do I get it back?

Tap anywhere on the terminal screen. If it does not appear, swipe down from the top status bar or hold the phone's Volume Up button and press Q.

3. How do I copy and paste in Termux?

Long press anywhere on the black terminal screen. A menu appears with COPY, PASTE, and MORE.

4. How do I exit Neovim?

Press ESC on your touch toolbar, type :wq, and press Enter to save and quit. To exit without saving, type :q! and press Enter.

5. Why do gcc and g++ work in Termux?

Standard Termux lacks GCC. ByteC adds lightweight binary wrappers for gcc and g++ that translate commands directly to Clang, so lab manual commands compile without modification.

6. Can I use an external keyboard with my phone?

Yes. Connect any USB keyboard via an OTG adapter, or pair a Bluetooth keyboard. All standard terminal and Neovim shortcuts (Ctrl + S, Ctrl + Z) work as expected.

7. Does ByteC require active internet?

Only during initial installation. After install, compilers, Neovim, templates, cheatsheets, and formatters work completely offline.

Uninstalling ByteC

To remove ByteC while keeping your source code safe:

bash
bytec uninstall

This removes the CLI binaries, touch key configurations, and shell hooks. Your source code inside ~/c_projects remains untouched.