Skip to content

Tag Archives: cpp-file-handling

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
rename() function is used to change the name of the file or directory i.e. from old_name to new_name without changing the content present in the… Read More
The tellp() function is used with output streams, and returns the current “put” position of the pointer in the stream. It has no parameters and… Read More
seekg() is a function in the iostream library that allows you to seek an arbitrary position in a file. It is included in the <fstream>… Read More
You are given a text file which contains any type of characters. You have to find the sum of integer values. Examples: Input : text.txt… Read More
We are given almost two identical files. But some characters are corrupted. We need to find the line number and their position where those corrupted… Read More
fgetc() fgetc() is used to obtain input from a file single character at a time. This function returns the ASCII code of the character read… Read More
ftell() in C is used to find out the position of file pointer in the file with respect to starting of the file. Syntax of… Read More
From a given file (e.g. input.txt) read the alternate nth byte and write it on another file with the help of “lseek”. lseek (C System… Read More
We will discuss about four file hacks listed as below- Rename – Rename a file using C/C++ Remove – Remove a file using C/C++ File… Read More
Given a huge file having dynamic data, write a program to read last n lines from the file at any point without reading the entire… Read More
Write a function that takes a file name as argument and prints all unique words in it. We strongly recommend you to minimize your browser… Read More
Write a C program that displays contents of given line page by page. Given number of lines to show as ‘n’ at a time and… Read More

Start Your Coding Journey Now!