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
How to Read From a File in C++?
Last Updated: 14 October 2024
Reading from a file means retrieving the data stored inside a file as input in the program. In this article, we will learn how to read data
...read more
cpp-file-handling
C++
C++ Programs
Picked
CPP Examples
Error Handling During File Operations in C
Last Updated: 16 April 2025
File operations are a common task in C programming, but they can encounter various errors that need to be handled gracefully. Proper error h
...read more
cpp-file-handling
C Language
C++
C-File Handling
File Handling
C Programs
C++ Programs
C Error Handling Programs
C++ Program to Create a File
Last Updated: 17 September 2024
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 f
...read more
cpp-file-handling
C++
C++ Programs
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
File Handling through C++ Classes
Last Updated: 22 April 2025
In C++, file handling refers to each operation that is related to a file, such as creating, reading, and writing data. It allows us is used
...read more
Technical Scripter
cpp-file-handling
C++
C Program to find size of a File
Last Updated: 28 April 2018
Given a text file, find its size in bytes.Examples:Input : file_name = "a.txt" Let "a.txt" contains "geeks"Output : 6 BytesThere ar
...read more
cpp-file-handling
C Language
C++
C-File Handling
C Programs
C++ program to read file word by word
Last Updated: 14 February 2023
Given a text file, extract words from it. In other words, read the content of file word by word. Example :Input: And in that dream, we were
...read more
cpp-file-handling
C++ Programs
I/O Redirection in C++
Last Updated: 24 April 2025
In C++, input and output operations are done in the form of sequence of bytes called stream through the stream objects like cin and cout. Th
...read more
cpp-input-output
cpp-file-handling
C++
Set Position with seekg() in C++ File Handling
Last Updated: 05 April 2022
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 header
...read more
CPP-Library
cpp-file-handling
C++
lseek() in C/C++ to read the alternate nth byte and write it in another file
Last Updated: 07 February 2018
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 Cal
...read more
cpp-file-handling
C Language
C++
C Program to Delete a File
Last Updated: 07 January 2025
C language allows the manipulation of the files present in the accessible storage directory allowing programmers to create, read, write and
...read more
cpp-file-handling
C Language
C Program to Merge Contents of Two Files into a Third File
Last Updated: 08 January 2025
Merging two files into a third file means copying the data of the two files and pasting them into the third file one after another. In this
...read more
cpp-file-handling
C Language
C program to copy contents of one file to another file
Last Updated: 10 January 2025
[GFGTABS] C #include stdio.h#include stdlib.h // For exit()int main(){ FILE *fptr1, *fptr2; char filename[100]; int c
...read more
cpp-file-handling
C Language
C Program to Print Contents of File
Last Updated: 07 January 2025
C language allows users to process the files in its programs. Reading a file is a step-by-step process in which we first have to prepare the
...read more
c-input-output
cpp-file-handling
C Language
C Programs
C File Handling Programs
C Program to list all files and sub-directories in a directory
Last Updated: 20 May 2017
[sourcecode language="C"]#include stdio.h#include dirent.hint main(void){ struct dirent *de; // Pointer for directory entry // opendi
...read more
cpp-file-handling
C Language
C Program to count number of lines in a file
Last Updated: 29 December 2022
[tabby title="C"][sourcecode language="c"]/* C Program to count the Number of Lines in a Text File */#include stdio.h#define MAX_FILE_NAME 1
...read more
cpp-file-handling
C Language
1
2
3
4
>>
Last
1
2
3
4
>>
Last
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 !