Hello, today I wanna start with my news:
I’ve finally finished my uni-project: Dictionary 🎉
Well, in the beginning it wasn’t hard: create a menu, let the user choose some options, give them an input to translate, send it to some API, get the result and output it.
Pretty easy, doesn’t it? Okay, let’s add “save” and “history” options. Well, the terminal version looks a little boring… just like:
Not good. I want pictures! I want cute animations! … that’s how I came across ncurses.
That’s how it went from an enjoyable — moderately hard program — to a super hard program that you have to debug for days.
My process:
1. Dictionary
I had to find a dictionary to translate words. There were 2 options: offline and online. I wanted experience with online APIs, so I naturally chose the online version.
Next, what to use? I wondered:
- Online translators (Google/Baidu — a Chinese Google) are paid + many western sites don’t work well in China. This project is for my professors, so I wanted them to run it without problems.
- DeepSeek — well… it doesn’t have a public API.
When I thought that was over, by chance, I found a Chinese translate AI API: Youdao AI Translate (be careful: fully in Chinese).
Good! I could still do my project. Onward: write code.
2. Coding the foundation
The root idea was pretty simple. I think I finished it in ~3–4 days:
Menu: translate with 2 modes:
CN→EN
andEN→CN
; history; saved words; exit-
Data structure: store word in English, word in Chinese, and
isFavorite
- At first, I wanted to add transcription/pinyin, but that requires more requests… well, basics first, maybe later.
- Used linked lists for saved/history words
-
Create API request: challenging, but I liked it:
-
curl
-
uuid
-
openssl
-
cJSON
(totally different than JavaScript)
-
Actually, I didn’t want to use curl
at first: I tried sending requests myself using a proxy…
But that added too much complexity. At that time, I didn’t fully understand what kind of program this would be, so I chose curl
. Proxy can wait for next time.
The app was ready and worked well.
3. Enter ncurses
Oh, here we are. My enjoyable program became my most hated program — rewriting the whole structure 2–3 times.
What happened?
- I wanted to add mascots. Stored in double-linked lists.
- Iterating through double lists using pointers — one more class for me.
- Connection issues: I use VPN in China. Sometimes it threw unexpected errors.
- OS: originally Linux program. On Windows (thanks WSL 🙏), still unexpected behaviors sometimes.
- Fonts in Chinese: Unicode, not ASCII. Terminal didn’t support Unicode initially. After hours, sometimes I saw characters; next day, garbage.
- Reorganized folder structure: initially ncurses in one file, logic in another. Here're we go again: Messy spaghetti code started.
- Ncurses windows: every window has coordinates. Had to track x, y carefully. Thanks, linear algebra classes!
- Buffer nightmare:
scanf
leaves\n
, ncurses windows also have buffers. Had to clear them every time.
Of course, I used ChatGPT for help. Just guidance. Not full copy-paste... Sometimes:
- I didn’t understand a bug →
- Ask ChatGPT →
- Read explanation carefully →
- Try code/copy →
- Doesn’t work → repeat 5+ times
In the end, I couldn’t understand anything, so I rewrote everything in a new file. Frustrating, but totally worth it.
4. Final thoughts
I finished the last line, ran it, and thought: GOOD ENOUGH, I FINISHED IT!
Then debugging time began… Makefile helped a lot, but imagine all the errors it showed: malloc
issues, missing headers, wrong function order. 😅
Summary
Even though it was harder than expected, I really like this project (even if it’s still buggy). I learned a lot:
- Sockets, SSL/TLS, OpenSSL, UUID: handling internet requests in C and understanding the differences between Windows and Linux. Big thanks to Ed Harmoush (@PracticalNetworking) and Jacob Sorber (@JacobSorber)! I learned all the topics mentioned above from their YouTube tutorials, which were really helpful for my project 😄
- cJSON: JSON parsing in C.
- Error handling – malloc/pointers issues, input buffers, ncurses buffers (it was hard)
- ncurses – terminal UI and animations
- Linked lists, data structures, buffers: deeper understanding.
- Makefile: first time learning automated compilation.
- README: writing a clean, portfolio-ready GitHub page.
This project taught me patience, debugging, and how to bring a terminal program to life. And most importantly — I still love it ❤️
If you’ve read until this line — wow, thanks for your time! I really appreciate it 😅
Top comments (0)