I want to check the output from the commend and print out different thing
I did successful print out when there are few line from wc *.cpp | ./test -l
but when it come to only one file,like wc test.cpp | ./test -l
it pop out the segmentation fault,how can I fix this??
when i type
1 2 3 4 5 6 7
wc *.cpp | ./test -l
1)The Number of Files : 4
2)The Largest File in lines : Testing.cpp (165lines)
3)The Smallest File in lines : piper.cpp (16lines)
4)The Total Number of lines : 281
Segmentation fault (core dumped)
when I type wc test.cpp | ./test -l
Segmentation fault (core dumped)
How can I fix these problems??
I am using do while loop to capture the few lines
1 2 3
do{
read output from wc *.cpp | ./test -l
}while
then how can I write the code to read the output from wc test.cpp | ./test -l
when there is only one line??