This project is a work in progress weatherclient that is currently being written in C90
This project is a console-based weather application written in C. It allows users to interactively select cities, fetch weather reports, and manage a local cache of city data. If the data is older than 15 minutes, the application fetches new information. The application features an interactive command-line interface, supports adding, removing, and editing city entries, and retrieves weather data (from an API via HTTP requests). City and weather data are serialized to and loaded from JSON files.
Key Features:
Interactive console UI for selecting cities and viewing weatherLocal cache of cities managed via JSON filesModular structure: distinct components for city management, weather retrieval, HTTP communication, and UIUses libcurl for HTTP requests and cJSON for JSON serialization/deserializationCustom utilities for string manipulation, input handling, and file operations
Technical Stack:
Language: C, with Makefile for build automationLibraries: cJSON (for JSON handling), libcurl (for HTTP requests) - working on support for JanssonCode is organized for maintainability and extensibility
Typical Usage Flow:
User starts the program and is greeted with a menu.User selects a city or manages the city list (add, edit, remove).Weather data is fetched and displayed for the selected city.Data is cached locally to speed up subsequent access and reduce API calls.To exit the program the user only has to type 'Q', 'Quit', 'E' or 'Exit'.
$ ./chas_malmo_weather
<===================# Welcome to the Weather App! #===================>
Stockholm Göteborg Malmö Uppsala Västerås
Örebro Linköping Helsingborg Jönköping Norrköping
Options(O/0) for options, Exit(E/Q) to exit.
Select a city: Malmö
Weather report has expired (cached 671388 seconds ago).
Retrieving new weather data...
City: Malmö (Lat: 55.6050 Lon: 13.0038)
Temperature: 13 °C
Windspeed: 2.40 m/s
Wind direction: West
Description: Overcast
Precipitation: 0.00 mm
Time stamp: 202510070945- gcc
- libcurl
- cJSON (included in
src/mcore/cJSON) - make
Designed for Ubuntu and Fedora. Working on extended support!
sudo apt install make gcc libcurl4-openssl-devgit clone https://github.com/samstalhandske/chas_malmo_weather.gitcd chas_malmo_weathermake
sudo dnf install make gcc libcurl-develgit clone https://github.com/samstalhandske/chas_malmo_weather.gitcd chas_malmo_weathermake
- Start the app:
./chas_malmo_weather - Select a city from the list or add your own.
- View weather reports, manage your city list, or exit.
src/
├── main.c # App entry point
├── ui/ClientUI.c # Console UI logic
├── city/City.c # City management
├── city/LinkedListCity.c # Handles the LinkedList and all other Cityfunctions
├── weather/Weather.c # Weather fetching & display
├── ui/ClientUI.c # The Client management
├── mcore/http/http.c # HTTP requests (libcurl)
├── mcore/json/cJSON/ # JSON parsing library
└── ... # Utilities and helpersClone repo and create a new branch: $ git checkout https://github.com/samstalhandske/chas_malmo_weather -b new_branch_not_yet_named.Make changes and test.Submit pull request with clear and descriptive change notes
- Sam Stålhandske
- Pontus Rosenquist
- Emilio Ganibegovic / Emilios other account
- Lukas Städe
- Pär Lundh
- Henrik Westerlund
- Isa Shipshani
- Jonathan Alestam
This is a project from the Malmo-branch of CHAS Academy and we are all students working on this project and as of now this is just a school project, so we are not accepting any donations. But be on the lookout for more upcoming projects over the next two years