Tuesday, August 26, 2025

[fread]: An old-school text file viewer for the modern terminal (GNU/Linux)

Last month I came across an old gem: PC Game Programmer's Encyclopedia, a DOS-era program built with the Pascal TUI Vision library. It’s a collection of docs about assembly and game programming compiled by Mark Feldman.

These files were originally stored in old MS-DOS encodings. Luckily, thanks to the dos2ansi project I was able to convert them into a more UTF-8-friendly format, making them readable on modern systems.

That got me thinking: why not create a modern TUI version for GNU/Linux to display these texts?

The first step was building a text file viewer that supports modern Unicode encoding. That’s how fread was born.


You can see it in action in this demo video.

The project has a modular approach:

  • openfile.c handles opening and reading files.

  • viewer.c takes care of displaying the contents, with both horizontal and vertical scrolling, screen resizing, and even binary file detection.

I'm quite happy with how it turned out and it is a marked improvement on my previous attempt at coding a textfile reader fw, which only supported ASCII characters. I like how you can keep writing the same style of program and still learn something new each time. I have quite a collection of TUI programs now :D

The next step will be to create a mock-up of the original DOS program with the dro-down menus at the top linking to the documents.


No comments:

Post a Comment