Skip to content

Tag Archives: cpp-file-handling

In this article, the task is to implement an ATM with functions like add, delete, search, and update users using file handling in C++.  … Read More
It is quite common that errors may occur while reading data from a file in C++ or writing data to a file. For example, an… Read More
Given a text file “file.txt” that consists of strings, the task is to sort all the strings in alphabetical order in that text file. Recommended:… Read More
Given a string str, the task is to print all the anagrams of the given string which forms a word that exists in English Dictionary.… Read More
Given that a binary file “student.dat” is already loaded in the memory of the computer with the record of 100 students, the task is to… Read More
CSV is a simple file format used to store tabular data such as a spreadsheet or a database. CSV stands for Comma Separated Values. The… Read More
Problem Statement: Write a C++ program to create a file using file handling and check whether the file is created successfully or not. If a… Read More
The fread() function in C++ reads the block of data from the stream. This function first, reads the count number of objects, each one with… Read More
In C++, files are mainly dealt by using three classes fstream, ifstream, ofstream available in fstream headerfile. ofstream: Stream class to write on files ifstream:… Read More
Given a text file, find its size in bytes. Examples: Input : file_name = "a.txt" Let "a.txt" contains "geeks" Output : 6 Bytes There are… Read More
Given a file and a line number n, the task is to delete nth line from the given text file. Suppose the initial content of… Read More
Given source and destination text files. Append the content from source file to destination file and then display the content of destination file. Example :… Read More
Given a text file, extract words from it. In other words, read the content of file word by word. Example : Input: And in that… Read More
In C, we could use the function freopen() to redirect an existing FILE pointer to another stream. The prototype for freopen() is given as FILE… Read More
Using remove() function in C, we can write a program which can destroy itself after it is compiled and executed. Explanation: This can be done… Read More