Skip to content
Courses
DSA to Development
Get IBM Certification
Newly Launched!
Master Django Framework
Become AWS Certified
For Working Professionals
Interview 101: DSA & System Design
Data Science Training Program
JAVA Backend Development (Live)
DevOps Engineering (LIVE)
Data Structures & Algorithms in Python
For Students
Placement Preparation Course
Data Science (Live)
Data Structure & Algorithm-Self Paced (C++/JAVA)
Master Competitive Programming (Live)
Full Stack Development with React & Node JS (Live)
Full Stack Development
Data Science Program
All Courses
Tutorials
Data Structures & Algorithms
ML & Data Science
Interview Corner
Programming Languages
Web Development
CS Subjects
DevOps And Linux
School Learning
Practice
Build your AI Agent
GfG 160
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
Contests
Accenture Hackathon (Ending Soon!)
GfG Weekly [Rated Contest]
Job-A-Thon Hiring Challenge
All Contests and Events
DSA
Practice Problems
Python
C
C++
Java
Courses
Machine Learning
DevOps
Web Development
System Design
Aptitude
Projects
Sign In
▲
Similar Topics
DSA
22.3k+ articles
C++
4k+ articles
Strings
3.2k+ articles
C++ Programs
2.5k+ articles
C Language
1.8k+ articles
C Programs
800+ articles
CPP Examples
700+ articles
cpp-input-output
68 articles
C-File Handling
48 articles
C++ File Programs
22 articles
cpp-file-handling
57 posts
Popular Articles
Recent Articles
cin.ignore() Function in C++
Last Updated: 22 August 2024
The cin.ignore() function in C++ is a member function of the std::istream. It is used to ignore (or discard) certain number of characters fr
...read more
cpp-file-handling
C++
C++ Programs
C++ File Programs
How to Open and Close a File in C++?
Last Updated: 08 February 2024
In C++, we can open a file to perform read and write operations and close it when we are done. This is done with the help of fstream objects
...read more
cpp-file-handling
C++
C++ Programs
Picked
CPP Examples
How to Read a File Using ifstream in C++?
Last Updated: 24 April 2025
In C++, we can read the contents of the file by using the ifstream object to that file. ifstream stands for input file stream which is a cla
...read more
cpp-input-output
cpp-file-handling
C++
C++ Programs
Picked
CPP Examples
Similar Topics
DSA
22.3k+ articles
C++
4k+ articles
Strings
3.2k+ articles
C++ Programs
2.5k+ articles
C Language
1.8k+ articles
C Programs
800+ articles
CPP Examples
700+ articles
cpp-input-output
68+ articles
C-File Handling
48+ articles
C++ File Programs
22+ articles
How to Read a File Line by Line in C++?
Last Updated: 05 February 2024
In C++, we can read the data of the file for different purposes such as processing text-based data, configuration files, or log files. In th
...read more
cpp-input-output
cpp-file-handling
C++
C++ Programs
Picked
CPP Examples
C++ Program to Get the List of Files in a Directory
Last Updated: 06 February 2023
Getting the list of files in a directory is one of the most common operations performed by the Filesystem of an OS. The file explorer applic
...read more
Technical Scripter
cpp-file-handling
C++
C++ Programs
Picked
Technical Scripter 2022
Opening Modes in Standard I/O in C/C++ with Examples
Last Updated: 01 February 2023
Pre-requisites: File Handling in C++So far the operations using the C program are done on a prompt/terminal that is not stored anywhere. But
...read more
cpp-file-handling
C Language
C++
C-File Handling
Sorting strings from the text file
Last Updated: 08 April 2023
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.Approach:
...read more
Strings
Sorting
cpp-file-handling
C-File Handling
File Handling
C++ Programs
DSA
Read a record from a File in C++ using seekg() and tellg()
Last Updated: 16 December 2022
Given that a binary file "student.data" is already loaded in the memory of the computer with the record of 100 students, the task is to read
...read more
cpp-file-handling
C++ Programs
Program to delete a line given the line number from a file
Last Updated: 20 February 2018
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 myfile.txt is :Gee
...read more
cpp-file-handling
C++
C++ Programs
C++ program to append content of one text file to another
Last Updated: 23 November 2022
Given source and destination text files. Append the content from the source file to the destination file and then display the content of the
...read more
cpp-file-handling
C++
C++ Programs
rename function in C
Last Updated: 21 September 2023
The rename() function is used to rename a file in C. It changes the name of the file from old_name to new_name without modifying the content
...read more
CPP-Library
cpp-file-handling
C Language
C++
C-File Handling
C-Library
C program to compare two files and report mismatches
Last Updated: 17 May 2017
We are given almost two identical files. But some characters are corrupted. We need to find the line number and their position where those c
...read more
cpp-file-handling
C Language
Four File Handling Hacks which every C/C++ Programmer should know
Last Updated: 15 March 2023
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 Size - Get
...read more
cpp-file-handling
C Language
C++
Implement your own tail (Read last n lines of a huge file)
Last Updated: 29 May 2017
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 file. The
...read more
cpp-file-handling
C Language
C++
fopen() for an existing file in write mode
Last Updated: 14 June 2022
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" is specified, it crea
...read more
cpp-file-handling
C Language
C-File Handling
First
1
2
3
4
>>
Last
First
1
2
3
4
>>
Last
First
1
2
3
4
>>
Last
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our
Cookie Policy
&
Privacy Policy
Got It !