Skip to content

Tag Archives: cpp-file-handling

The remove function in C/C++ can be used to delete a file. The function returns 0 if files is deleted successfully, other returns a non-zero… Read More
Let the given two files be file1.txt and file2.txt. The following are steps to merge. 1) Open file1.txt and file2.txt in read mode. 2) Open… Read More
#include <stdio.h> #include <stdlib.h> // For exit()    int main() {     FILE *fptr1, *fptr2;     char filename[100], c;        printf("Enter the filename to open for reading… Read More
fopen() is used to open and fclose() is used to close a file in C #include <stdio.h> #include <stdlib.h> // For exit()    int main()… Read More
#include <stdio.h> #include <dirent.h>    int main(void) {     struct dirent *de;  // Pointer for directory entry        // opendir() returns a pointer of DIR type. … Read More
C /* C Program to count the Number of Lines in a Text File  */ #include <stdio.h> #define MAX_FILE_NAME 100   int main() {     FILE… Read More
In C, fopen() is used to open a file in different modes. To open a file in write mode, “w” is specified.  When mode “w”… Read More

Start Your Coding Journey Now!