SlideShare a Scribd company logo
2
Most read
3
Most read
8
Most read
BY SONALI GHOLVE
 A file is collection of related data storage in
particular area on disk.
Output file stream
Read data
Disk
Files
C++ Program
input file stream
Data output
Write data
Data input
 Stream: Sequence of bits
 Input streams: Stream that supplies data to a
program.
 Output stream : Stream that receive data
from the program
 File stream: Input file and output file
collectively known as file stream
 IO stream:This stream used for both read and
write the data
File handling in c++
 Open
 Close
 Read
 Write
 End of file
 Delete
 Update
 ios::app -> Append to end to file
 ios ::ate -> Go to end of file on opening
 ios ::binary ->Binary file
 ios ::in -> Open file for reading only
 ios :: nocreate ->Open fails if the file does not
exist
 ios ::noreplace-> Open fails if the file already
exist
 ios ::out -> Open file for writing only
 ios :: trunc ->Delete the contents of file if it
exist
 Input pointer (get pointer): Used when
reading the contents of file at the given
location.
 Output Pointer: Used when writing the
content into the given location.
 seekg() : Moves the get pointer to a specified
location.
Syntax : seekg(location);
 seekp():Moves the put pointer to a specified
location.
Syntax : seekp(location);
 tellg(): By using this function we can know the
current location of the get pointer.
Int curloc=ob.tellg();
 tellp(): By using this function we can know the
current location of the put pointer.
Int curloc=ob.tellp();
 Put() :Writes single character to the
associated stream
 Get() : Reads single character to the
associated stream
 Read() :To read a data in binary format
 Write() :To write a data in binary format
Thank you!!!!!!!!!
For any query please send me mail on
sonalisagargholve@gmail.com

More Related Content

PPTX
PDF
Python file handling
PPTX
Abstract class in c++
PPT
File handling in c
PPTX
Union in C programming
PPTX
Python Exception Handling
Python file handling
Abstract class in c++
File handling in c
Union in C programming
Python Exception Handling

What's hot (20)

PPTX
Procedural vs. object oriented programming
PPTX
Command line arguments
PPTX
Preprocessor directives in c language
PPTX
Functions in c++
PPT
FUNCTIONS IN c++ PPT
PPTX
Type casting in c programming
PDF
C++ Files and Streams
PPSX
Files in c++
PPTX
classes and objects in C++
PPTX
Unit 3. Input and Output
PDF
Files in C
PDF
Function overloading ppt
PDF
Object oriented programming c++
PPTX
Data Type in C Programming
PPTX
File Handling Python
PPTX
Presentation on-exception-handling
PPTX
Inline Functions and Default arguments
PPTX
Data Type Conversion in C++
PPTX
Functions in c language
PPTX
Dynamic memory allocation in c
Procedural vs. object oriented programming
Command line arguments
Preprocessor directives in c language
Functions in c++
FUNCTIONS IN c++ PPT
Type casting in c programming
C++ Files and Streams
Files in c++
classes and objects in C++
Unit 3. Input and Output
Files in C
Function overloading ppt
Object oriented programming c++
Data Type in C Programming
File Handling Python
Presentation on-exception-handling
Inline Functions and Default arguments
Data Type Conversion in C++
Functions in c language
Dynamic memory allocation in c
Ad

Similar to File handling in c++ (20)

PDF
File Handling.pdffile handling ppt final
PDF
Filesinc 130512002619-phpapp01
PPT
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
PPT
File handling in_c
PDF
Files and streams
PPT
file_handling_in_c.pptbbbbbbbbbbbbbbbbbbbbb
PPT
file_handling_in_c.ppt......................................
PPT
working file handling in cpp overview
PPTX
basics of file handling
PPTX
Basics of file handling
PPTX
File Handling
PDF
Files in C++.pdf is the notes of cpp for reference
PDF
Data file handling
PDF
Basics of files and its functions with example
DOCX
Filehandling
PPTX
Files in c++
PPTX
working with files
PDF
Chapter28 data-file-handling
PPTX
Working with files in c++. file handling
File Handling.pdffile handling ppt final
Filesinc 130512002619-phpapp01
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
File handling in_c
Files and streams
file_handling_in_c.pptbbbbbbbbbbbbbbbbbbbbb
file_handling_in_c.ppt......................................
working file handling in cpp overview
basics of file handling
Basics of file handling
File Handling
Files in C++.pdf is the notes of cpp for reference
Data file handling
Basics of files and its functions with example
Filehandling
Files in c++
working with files
Chapter28 data-file-handling
Working with files in c++. file handling
Ad

More from ProfSonaliGholveDoif (6)

PPTX
Searching in Artificial Intelligence for UG
PPTX
Artificial Intelligence Basics part 1 for UG students
PPTX
Introduction to Data Structure part 1
PPTX
Inheritance in c++theory
PPTX
Macro and Preprocessor in c programming
PPTX
String predefined functions in C programming
Searching in Artificial Intelligence for UG
Artificial Intelligence Basics part 1 for UG students
Introduction to Data Structure part 1
Inheritance in c++theory
Macro and Preprocessor in c programming
String predefined functions in C programming

Recently uploaded (20)

PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
Basic Mud Logging Guide for educational purpose
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Pharma ospi slides which help in ospi learning
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
PDF
01-Introduction-to-Information-Management.pdf
PDF
Open folder Downloads.pdf yes yes ges yes
PPTX
PPH.pptx obstetrics and gynecology in nursing
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
Open Quiz Monsoon Mind Game Prelims.pptx
Insiders guide to clinical Medicine.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
GDM (1) (1).pptx small presentation for students
Microbial diseases, their pathogenesis and prophylaxis
Basic Mud Logging Guide for educational purpose
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Pharma ospi slides which help in ospi learning
Microbial disease of the cardiovascular and lymphatic systems
Abdominal Access Techniques with Prof. Dr. R K Mishra
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
BÀI TẬP TEST BỔ TRỢ THEO TỪNG CHỦ ĐỀ CỦA TỪNG UNIT KÈM BÀI TẬP NGHE - TIẾNG A...
01-Introduction-to-Information-Management.pdf
Open folder Downloads.pdf yes yes ges yes
PPH.pptx obstetrics and gynecology in nursing

File handling in c++

  • 2.  A file is collection of related data storage in particular area on disk. Output file stream Read data Disk Files C++ Program input file stream Data output Write data Data input
  • 3.  Stream: Sequence of bits  Input streams: Stream that supplies data to a program.  Output stream : Stream that receive data from the program  File stream: Input file and output file collectively known as file stream  IO stream:This stream used for both read and write the data
  • 5.  Open  Close  Read  Write  End of file  Delete  Update
  • 6.  ios::app -> Append to end to file  ios ::ate -> Go to end of file on opening  ios ::binary ->Binary file  ios ::in -> Open file for reading only  ios :: nocreate ->Open fails if the file does not exist  ios ::noreplace-> Open fails if the file already exist  ios ::out -> Open file for writing only  ios :: trunc ->Delete the contents of file if it exist
  • 7.  Input pointer (get pointer): Used when reading the contents of file at the given location.  Output Pointer: Used when writing the content into the given location.
  • 8.  seekg() : Moves the get pointer to a specified location. Syntax : seekg(location);  seekp():Moves the put pointer to a specified location. Syntax : seekp(location);  tellg(): By using this function we can know the current location of the get pointer. Int curloc=ob.tellg();  tellp(): By using this function we can know the current location of the put pointer. Int curloc=ob.tellp();
  • 9.  Put() :Writes single character to the associated stream  Get() : Reads single character to the associated stream  Read() :To read a data in binary format  Write() :To write a data in binary format
  • 10. Thank you!!!!!!!!! For any query please send me mail on sonalisagargholve@gmail.com