#include #include /***** * Author: G. Towell * Created: August 2019 * Modified: Sep 17 2019 * Program to read line by line from stdin until get an EOF * Along way calculate the length of the line and accumulate the ascii value of each character read. * Finally, replace the \n with \0 to get rid of the \n from the line before printing it. * Note use of strlen from string.h to get line length * * Usage: * cat inn.txt | ./a.out * a.out < inn.txt *****/ #define LINE_LEN 256 int main(void) { int summ=0; char line[LINE_LEN]; while (NULL != fgets(line, LINE_LEN, stdin)) { int llen=0; for (llen=0; llen