I have compiled and executed program successfully but facing an issue with line feeds(LF) in text file. Could you please help me on this.
It is a program for counting number of elements in text file input
When I am editing test.txt through vi editor or text editor on LINUX machine, it is automatically adding LF(ASCII 10 ('\n')) at the end of all characters and the program counting it as an extra character. I unable to find a way to remove LF through editor. Please help me on this.
output is
priya:~/Desktop/asdf$ gcc -g bug.c -o bug
priya:~/Desktop/asdf$ cat test.txt | od -c
0000000 a b c d \n
0000005
priya:~/Desktop/asdf$ ./bug
Count ASCII Char
1 97 a
2 98 b
3 99 c
4 100 d
5 10
The # of elements in the file is 5