{"id":30055191,"url":"https://github.com/eoan-ermine/ccwc","last_synced_at":"2025-08-07T21:48:22.423Z","repository":{"id":210308043,"uuid":"726170367","full_name":"eoan-ermine/ccwc","owner":"eoan-ermine","description":"Simple wc implementation in C++","archived":false,"fork":false,"pushed_at":"2023-12-15T07:58:24.000Z","size":163,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-15T08:36:23.935Z","etag":null,"topics":["codingchallenges"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eoan-ermine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-01T17:25:11.000Z","updated_at":"2023-12-01T21:49:18.000Z","dependencies_parsed_at":"2023-12-01T23:23:05.656Z","dependency_job_id":"e826716d-230f-44b5-ac54-d18026f00022","html_url":"https://github.com/eoan-ermine/ccwc","commit_stats":null,"previous_names":["eoan-ermine/ccwc"],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/eoan-ermine/ccwc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoan-ermine%2Fccwc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoan-ermine%2Fccwc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoan-ermine%2Fccwc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoan-ermine%2Fccwc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eoan-ermine","download_url":"https://codeload.github.com/eoan-ermine/ccwc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eoan-ermine%2Fccwc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269331296,"owners_count":24399127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-07T02:00:09.698Z","response_time":73,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codingchallenges"],"created_at":"2025-08-07T21:48:14.825Z","updated_at":"2025-08-07T21:48:22.414Z","avatar_url":"https://github.com/eoan-ermine.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ccwc\n\n## Building ccwc with CMake\n\n```shell\ncmake -S . -B build\ncmake --build build\ncmake --build build -t test\n```\n\n## CCWC CMake variables\n\n* **CCWC_TEST**:BOOL\u003cbr/\u003e\nInclude ccwc tests in the `all` build target. Defaults to ON.\n\n* **CCWC_CCACHE_BUILD**:BOOL\u003cbr/\u003e\nIf enabled and the ccache program is available, then CCWC will be built using ccache to speed up rebuilds of CCWC and its components. Defaults to ON.\n\n# Write Your Own wc Tool\n\nThis challenge is to build your own version of the Unix command line tool wc!\n\nThe Unix command line tools are a great metaphor for good software engineering and they follow the Unix Philosophies of:\n\nWriting simple parts connected by clean interfaces - each tool does just one thing and provides a simple CLI that handles text input from either files or file streams.\nDesign programs to be connected to other programs - each tool can be easily connected to other tools to create incredibly powerful compositions.\nFollowing these philosophies has made the simple unix command line tools some of the most widely used software engineering tools - allowing us to create very complex text data processing pipelines from simple command line tools. There’s even a Coursera course on [Linux and Bash for Data Engineering](https://gb.coursera.org/learn/linux-and-bash-for-data-engineering-duke).\n\nYou can read more about the Unix Philosophy in the excellent book [The Art of Unix Programming](http://www.catb.org/~esr/writings/taoup/html/).\n\n## The Challenge - Building wc\n\nThe functional requirements for wc are concisely described by it’s man page - give it a go in your local terminal now:\n\n```shell\nman wc\n```\n\nThe TL/DR version is: wc – word, line, character, and byte count.\n\n### Step Zero\n\nLike all good software engineering we’re zero indexed! In this step you’re going to set your environment up ready to begin developing and testing your solution.\n\nI’ll leave you to setup your IDE / editor of choice and programming language of choice. After that here’s what I’d like you to do to be ready to test your solution.\n\nDownload the [this](https://www.dropbox.com/scl/fi/d4zs6aoq6hr3oew2b6a9v/test.txt?rlkey=20c9d257pxd5emjjzd1gcbn03\u0026dl=0) text and save it as `test.txt`.\n\n### Step One\n\nIn this step your goal is to write a simple version of wc, let’s call it ccwc (cc for Coding Challenges) that takes the command line option -c and outputs the number of bytes in a file.\n\nIf you’ve done it right your output should match this:\n\n```shell\n\u003e ccwc -c test.txt\n342190 test.txt\n```\n\nIf it doesn’t, check your code, fix any bugs and try again. If it does, congratulations! On to…\n\n### Step Two\n\nIn this step your goal is to support the command line option -l that outputs the number of lines in a file.\n\nIf you’ve done it right your output should match this:\n\n```shell\n\u003e ccwc -l test.txt\n7145 test.txt\n```\n\nIf it doesn’t, check your code, fix any bugs and try again. If it does, congratulations! On to…\n\n### Step Three\n\nIn this step your goal is to support the command line option -w that outputs the number of words in a file. If you’ve done it right your output should match this:\n\n```shell\n\u003e ccwc -w test.txt\n58164 test.txt\n```\n\nIf it doesn’t, check your code, fix any bugs and try again. If it does, congratulations! On to…\n\n### Step Four\n\nIn this step your goal is to support the command line option -m that outputs the number of characters in a file. If the current locale does not support multibyte characters this will match the -c option.\n\nYou can learn more about programming for locales [here](https://learn.microsoft.com/en-us/globalization/locale/locale-and-culture)\n\nFor this one your answer will depend on your locale, so if can, use wc itself and compare the output to your solution:\n\n```shell\n\u003e ccwc -m test.txt\n339292 test.txt\n```\n\nIf it doesn’t, check your code, fix any bugs and try again. If it does, congratulations! On to…\n\n### Step Five\n\nIn this step your goal is to support the default option - i.e. no options are provided, which is the equivalent to the -c, -l and -w options. If you’ve done it right your output should match this:\n\n```shell\n\u003e ccwc test.txt\n7145 58164 342190 test.txt\n```\n\nIf it doesn’t, check your code, fix any bugs and try again. If it does, congratulations! On to…\n\n### The Final Step\n\nIn this step your goal is to support being able to read from standard input if no filename is specified. If you’ve done it right your output should match this:\n\n```shell\n\u003e cat test.txt | ccwc -l\n7145\n```\n\nIf it doesn’t, check your code, fix any bugs and try again. If it does, congratulations! You’ve done it, pat yourself on the back, job well done!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feoan-ermine%2Fccwc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feoan-ermine%2Fccwc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feoan-ermine%2Fccwc/lists"}