7.04 Reading from file and Writing into file, C++

Share this & earn $10
Darshan Institute of Engineering & Technology
Published at : 28 Jan 2021
6338 views
45
3

Understanding filestream classes for file operations. Creating and opening file to read content from file and write content to the file. C++ program for file handling of text file or binary file with various file opening modes.

fstreambase: Provides operations common to the file streams. Contains open() and close() functions.
Ifstream: Provides input operations. Contains open() with default input mode. Inherits get(), getline(), read(), seekg() and tellg() functions from istream.
ofstream: Provides output operations. Contains open() with default output mode. Inherits put(), seekp(), tellp() and write() functions from ostream.
fstream: Provides support for simultaneous input and output operations. Inherits all the functions from istream and ostream from iostream.
filebuf: Its purpose is to set the file buffers to read and write.
ios :: in: Open file for reading only. ios :: out: Open file for writing only.
ios :: app: Append to end-of-file. ios :: ate: Go to end-of-file on opening.
ios :: binary: Binary file. ios :: trunc: Delete content of file if exists.
ios :: nocreate: Open fails if the file does not exist. ios :: noreplace: Open fails if the file already exists.
Each file has two associated pointers known as the file pointers.
One of them is called input pointer (or get pointer) and the other is called output pointer (or put pointer).
Input pointer is used for reading the content of a given file location.
Output pointer is used for writing to a given file location.

GTU - Computer Engineering (CE) - Semester 4 - 2140703 - Object Oriented Programming with C++ - Concepts of C++ - Introduction to Object Oriented Programming

Object-Oriented Programming with C++ PPTs are available here: http://www.darshan.ac.in/DIET/CE/GTU-Computer-Engineering-Study-Material

This video is recorded by Prof. Rupesh Vaishnav (rupesh.vaishnav@darshan.ac.in, +91-9428037452) at Computer Engineering Department of Darshan Institute of Engineering & Technology, Rajkot as per GTU Syllabus.

Darshan Institute of Engineering & Technology, Rajkot is a leading institute offering undergraduate, graduate and postgraduate programs in engineering. The Institute is affiliated to the Gujarat Technological University (GTU) and approved by the AICTE, New Delhi.

Visit us: http://www.darshan.ac.in
Write us: info@darshan.ac.in
Facebook: https://www.facebook.com/DarshanInstitute.Official
Twitter: https://www.twitter.com/darshan_inst
Instagram: https://www.instagram.com/darshan_inst/
file handling in C++openread

Dream Cruisin' Webisode #1 - The History of "Cruising"

Dream Cruisin' Webisode #1 - The History of "Cruising"

The Arrival La Llegada (1996) en español latino

The Arrival La Llegada (1996) en español latino

Pump Up the Pattern | Fun Exercise Song for Kids | Jack Hartmann

Pump Up the Pattern | Fun Exercise Song for Kids | Jack Hartmann

Providing Quality Customer Service! - Retail Horror Game (Night of the Consumers) | xQcOW

Providing Quality Customer Service! - Retail Horror Game (Night of the Consumers) | xQcOW

DMing YouTubers to Shop For Me on AMAZON!!

DMing YouTubers to Shop For Me on AMAZON!!

A group of guys get scared in VR.

A group of guys get scared in VR.

No sooner...Than..

No sooner...Than..

Fix Instagram You'll Be Able to Change Your Username Back For Another 14 Days

Fix Instagram You'll Be Able to Change Your Username Back For Another 14 Days

Love, Guaranteed Trailer #1 (2020) | Rotten Tomatoes TV

Love, Guaranteed Trailer #1 (2020) | Rotten Tomatoes TV

Chief Justice Laments: Criminal Justice System On The Verge Of Collapse

Chief Justice Laments: Criminal Justice System On The Verge Of Collapse

I LOST BOTH OUR DOGS!! **MY MOM CRIED!** #LillyK #lostdogs

I LOST BOTH OUR DOGS!! **MY MOM CRIED!** #LillyK #lostdogs

$2,000 Stimulus Check Update & Package News: Trump Impeachment & Rental Assistance Issues - Jan 11

$2,000 Stimulus Check Update & Package News: Trump Impeachment & Rental Assistance Issues - Jan 11

Torn Paper Effect | Photoshop Tutorial

Torn Paper Effect | Photoshop Tutorial

Flexibility Training Secrets [Why You Aren't Getting Results]

Flexibility Training Secrets [Why You Aren't Getting Results]

Stay (cover) New Found Glory feat. Lisa Loeb

Stay (cover) New Found Glory feat. Lisa Loeb

(LIVE) The Most Epic Short Squeeze In History // R/Wallstreetbets 🚀💎

(LIVE) The Most Epic Short Squeeze In History // R/Wallstreetbets 🚀💎

Female Captain Refuses to Give Up During Grueling 12 Mile March

Female Captain Refuses to Give Up During Grueling 12 Mile March

Present Day - E's Jammy Jams

Present Day - E's Jammy Jams

Reading is Fundamental! From Paris is Burning

Reading is Fundamental! From Paris is Burning

The Most Beautiful Car In The World!

The Most Beautiful Car In The World!

TUTORIAL: How To Make $100 a Day with FREE SEO Traffic (Shopify SEO Tutorial)

TUTORIAL: How To Make $100 a Day with FREE SEO Traffic (Shopify SEO Tutorial)

Jungkook is so protective when it comes to Taehyung

Jungkook is so protective when it comes to Taehyung

7 RAREST ITEMS in WoW of All Time!

7 RAREST ITEMS in WoW of All Time!

THE ANNOYING ADWARE!?! - Virus Investigations 4

THE ANNOYING ADWARE!?! - Virus Investigations 4

Maroon 5 - Misery (UK Version) (Official Music Video)

Maroon 5 - Misery (UK Version) (Official Music Video)

BLU Team's Unusual Day

BLU Team's Unusual Day

Funny Animation 20 mins | Cartoons for kids

Funny Animation 20 mins | Cartoons for kids

How to Produce Liquid Soap In Large Quantity

How to Produce Liquid Soap In Large Quantity

Interior (Interior)

Interior (Interior)

Behind The Hands Of A Tasty Producer, Part I

Behind The Hands Of A Tasty Producer, Part I

Feminist Epistemology Part 2: Standpoint Theory - MGTOW

Feminist Epistemology Part 2: Standpoint Theory - MGTOW

What's so great about 2021 ?? Happy New Year From Inquisitive Thinking !!

What's so great about 2021 ?? Happy New Year From Inquisitive Thinking !!

"You've gotten a lot farther than you should have..."

"You've gotten a lot farther than you should have..."

6 Most-Popular Tasty Recipe Videos Of The Year • Tasty

6 Most-Popular Tasty Recipe Videos Of The Year • Tasty

the best selling album of each year // 2000 - 2019

the best selling album of each year // 2000 - 2019

Leon Haywood - Baby Reconsider

Leon Haywood - Baby Reconsider

How to fix: No model specified in Proteus 8.1 (Connectors)

How to fix: No model specified in Proteus 8.1 (Connectors)

80/20 Mindset | Tips To Structure Your Day | Be More Productive

80/20 Mindset | Tips To Structure Your Day | Be More Productive

Luxury Motor Home from Saboo Force

Luxury Motor Home from Saboo Force

Tequila Taco Night - Epic Meal Time

Tequila Taco Night - Epic Meal Time

Q&A with CEO of ChromaWay: How do you intend to attract users and developers to Сhromapolis?

Q&A with CEO of ChromaWay: How do you intend to attract users and developers to Сhromapolis?

for KING & COUNTRY - JOY [LIVE at EOJD 2018]

for KING & COUNTRY - JOY [LIVE at EOJD 2018]

How to Develop a Good Research Topic

How to Develop a Good Research Topic

१ महिनामा पुरै Syllabus कसरि सक्ने?? How to finish whole syllabus in one month

१ महिनामा पुरै Syllabus कसरि सक्ने?? How to finish whole syllabus in one month

Ataxia - The Sides

Ataxia - The Sides

Dr Tedros on the milestone of smallpox eradication and lessons learned for COVID-19 response

Dr Tedros on the milestone of smallpox eradication and lessons learned for COVID-19 response

Still Complaining? (The Rich and Poor)

Still Complaining? (The Rich and Poor)

Сильный снегопад в Италии, Первый снег за 10 лет в Милане, снегопад Италия, снегопад | боль земли

Сильный снегопад в Италии, Первый снег за 10 лет в Милане, снегопад Италия, снегопад | боль земли

Jake Cooper, Joey Busse - On Its Own

Jake Cooper, Joey Busse - On Its Own