CWC is a simple utility to count characters, words, and lines in a file or given text.
- Count characters in a file
- Count words in a file
- Count lines in a file
- Flexible command-line interface using a custom argument parser
cwc [OPTIONS] -f <filename>
-v, --version
: Print the version of the program-h, --help
: Print the help message-c, --charc
: Count the number of characters-w, --word
: Count the number of words-l, --line
: Count the number of lines-f, --file <filename>
: Specify the path of the file to read from
Count all (lines, words, and characters):
cwc -f example.txt
Count only characters:
cwc -c -f example.txt
Count only words:
cwc -w -f example.txt
Count only lines:
cwc -l -f example.txt
To build the project, make sure you have a C compiler installed. Then run:
gcc -o cwc main.c -I.
Copy
Note: The custom argparse.h
header file should be in the same directory as main.c
.
This project uses a custom argparse.h
header file for command-line argument parsing. This header file includes the implementation of the argument parser, so no separate .c
file is required.
- Support for short and long option names
- Handling of flag and value type arguments
- Automatic help and version printing
- Error and warning messages with color coding
1.0.0