A fun little C project to explore signals and inter-process communication (IPC).
This program prints a "Program is Running..."
message in a loop, reacts to Ctrl+C by playing a sound, and can be exited cleanly by pressing q.
- Runs continuously, printing a message.
- Handles
SIGINT
(Ctrl+C
) → playsmeow.mp3
instead of terminating. - Press
q
+ Enter to quit gracefully. - Uses SDL2 and SDL2_mixer for audio playback.
- Cross-platform exploration (tested on Windows MSYS2/MinGW64).
- MSYS2 (for Windows users)
- SDL2 development libraries
- SDL2_mixer development libraries
- GCC compiler (
mingw-w64-x86_64-gcc
)
gcc -o program_a program_a.c play_audio.c -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer
./program_a
-
The program prints:
Process ID: 18408 Press 'q' + Enter to quit Press Ctrl+C to wake up the cat Program is Running...
-
Press Ctrl+C → Plays
meow.mp3
🐱 -
Press q + Enter → Exits cleanly.
.
├── program_a.c # Main program (signal handling + message loop)
├── play_audio.c # Audio utility functions
├── play_audio.h # Audio function declarations
├── meow.mp3 # Example sound file (not included in repo)
└── README.md
Click to expand setup instructions
- Download installer from https://www.msys2.org/
- Run installer and let it update.
-
Start Menu → search MSYS2 MinGW64
-
Your prompt should look like:
username@PC MINGW64 ~
pacman -Syu
(Close and reopen MSYS2 MinGW64 terminal if asked.)
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 mingw-w64-x86_64-SDL2_mixer
cd /c/projects/githubprojects/Meow/program_a
gcc -o program_a program_a.c play_audio.c -lmingw32 -lSDL2main -lSDL2 -lSDL2_mixer
./program_a
This project was inspired by hands-on experiments with signals and SDL2. It is adapted from the following repository:
Original Repository Template:
- Repo: program_a
- Author: Jorge Villalta
- Youtube Video : Explanation About Signals