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
GfG 160: Daily DSA
Problem of the Day
Practice Coding Problems
GfG SDE Sheet
DSA
Practice Problems
C
C++
Java
Python
JavaScript
Data Science
Machine Learning
Courses
Linux
DevOps
SQL
Web Development
System Design
Aptitude
GfG Premium
Sign In
▲
Similar Topics
DSA
22.5k+ articles
C++
4.2k+ articles
Strings
3.2k+ articles
C++ Programs
2.4k+ articles
C Language
2.1k+ articles
CPP Examples
700+ articles
C Programs
690+ 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: 12 May 2025
Reading from a file means retrieving the data stored inside a file. C++ file handling allows us to read different files from our C programs.
...read more
cpp-file-handling
C++
C++ Programs
Picked
CPP Examples
Error Handling During File Operations in C
Last Updated: 13 May 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.5k+ articles
C++
4.2k+ articles
Strings
3.2k+ articles
C++ Programs
2.4k+ articles
C Language
2.1k+ articles
CPP Examples
700+ articles
C Programs
690+ articles
cpp-input-output
68+ articles
C-File Handling
48+ articles
C++ File Programs
22+ articles
File Handling through C++ Classes
Last Updated: 15 May 2025
In C++, programs run in the computer’s RAM (Random Access Memory), in which the data used by a program only exists while the program is ru
...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: 15 May 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 !