I wrote my first C project after a long time. Unix wc clone. NO AI

emanueleoggiano1 pts1 comments

GitHub - emanueleoggiano/word_count: Word counter in C · GitHub

/" data-turbo-transient="true" />

Skip to content

Type / to search

Sign in<br>Sign upAppearance settings

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

emanueleoggiano

word_count

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>5 Commits<br>5 Commits

.gitignore

.gitignore

LICENSE

LICENSE

README.md

README.md

main.c

main.c

View all files

Repository files navigation

Word Count in C (wc-clone)

This project is an implementation of the Unix command wc (Word Count) written in C.<br>It was built to understand how to read from a file and how to use macros to handle errors

Functionalities

Word Counter : Count the words in a given file, avoiding white spaces and other ascii symbols;

Row Counter : Count the rows in a given file, analyzing the \n character.

Usage

To compile the main.c file you must have gcc or any other C compiler. In the terminal you write:

gcc -O2 main.c -o word_count

and then:

./word_count example.txt

Example

Suppose the example.txt file contains the following:

Hello, 123, World !!<br>WordCount Clone in C

The output of the program will be:

The number of words is: 7<br>The number of rows is: 2

TO DO

Flag detector : Right now the program does not take -l, -w etc as arguments

Character counter : Count the characters in the file

Specific separator counter : Right now the program does not check for user requested separators as ,, ., etc

License

This project has been released under the MIT License

Contribution

Feel free to contribute to the project

About<br>Word counter in C<br>Resources<br>Readme<br>MIT license<br>Activity<br>Stars<br>0 stars<br>Watchers<br>0 watching<br>Forks<br>0 forks<br>Report repository

Releases

Packages

Contributors

Languages

You can’t perform that action at this time.

file counter word main license count

Related Articles