C Programs 55 Lessons

C Program to Find the Number of Lines in a Text File

Number of lines in a file can be determined by counting the number of new line characters present. #include <stdio.h> int main() / Ask for a filename and count number of lines in the file/ { //a pointer to a […]

    C Program to Replace a Specific Line in a Text File

    This C program is used to replace a specific line in a text file. #include <stdio.h> int main(void) { FILE fp1, fp2; //'filename'is a 40 character string to store filename char filename[40]; char c; int del_line, temp = 1; //asks […]

      Scroll Back to Top