尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
M.SUJITHA,M.SC.,
N.S College, Theni.
C++ STREAM CLASSES
Ios:
It contains basic facilities that are used by all other
input and output classes.
Istream:
It inherites the properties of ios and it declares input
functions such as get(),getline() and read().
Ostream:
It inherites the properties of ios and it declares
output functions such as put() and write().
Iostream:
It inherites the properties of ios stream and ostream.
Streambuf:
It provides an interface to physical devices through
buffers.
The features that supports to format the console
I/O operations are:
◦ Ios class functions and flags
◦ Manipulators
◦ User-defined output functions
IOS CLASS FUNCTIONS AND FLAGS:
It consists of large number of member functions
that is used to format the output in number of ways.
 MANIPULATORS:
These are the special functions that are
included in the I/O statements to format the
parameters of a stream.
 DEFINING FIELD WIDTH:
◦ It is used to define the width of the field.
◦ Can be defined using width();
SETTING PRECISION:
It is used to specify the to be displayed after the
decimal point.
FILLING AND PADDING:
 It is used to print the values using the larger field
widths.
 It can be declared by,
cout.fill();
#include <iostream>
using namespace std;
int main()
{
int item[4] ={ 10,8,12,15};
int cost[4]={75,100,60,99};
cout.width(5);
cout<<”Items”;
cout.width(8);
cout<<”Cost”;
cout.width(15);
cout<<”Total Value”<<”n”;
int sum=0;
for(int i=0;i<4 ;i++)
{
cout.width(5);
cout<<items[i];
cout.width(8);
cout<<cost[i];
int value = items[i] * cost[i];
cout.width(15);
cout<<value<<”n”;
sum= sum + value;
}
cout<<”n Grand total = “;
cout.width(2);
cout<<sum<<”n”;
return 0;
}
OUTPUT:
ITEMS COST TOTAL VALUE
10 75 750
8 100 800
12 60 720
15 99 1485
Grand total =3755
It is used for defining the input and output in
various forms.
Overloaded Operators >> and <<:
• It is used to give the I/O
• The >> is overloaded in istream class
• The << is overloaded in ostream class
Ex:
cin>>item1>>item2;
put() and get() Functions:
◦ It is used for the input and output .
◦ Put(c) is used to give the input
◦ Get(c) is used to get the output
EXAMPLE:
#include <iostream>
using namespace std;
int main()
{
int count=0;
char c;
cout<<”INPUT TEXT n”;
cin.get( c );
while ( c 1=’n’ )
while ( c 1=’n’ )
{
cout.put( c);
count++;
cin.get( c );
}
cout<< “n Number of characters =” <<count <<”n”;
return 0;
}
OUTPUT:
Object oriented programming
Number of characters=27
Getline() and write() Functions:
• The getline() function reads a whole line of the
text and ends with a newline character.
• This function can be invoked by,
cin.getline (line,size);
• The writeline() function reads a whole line of the
text and displays an entire line.
• This function can be invoked by,
cout.write (line,size);
EXAMPLE:
#include <iostream>
using namespace std;
int main()
{
int size=20;
char city[20];
cout<<”enter city name:n “;
cin>>city;
cout<<”city name:”<<city<<”nn”;
cout<<”enter city name again: n”;
cin.getline(city,size);
cout<<”city name now:”<<city<<”nn”;
cout<<”enter another city name: n”;
cin.getline(city,size);
cout <<”New city name:”<<city<<”nn’;
return 0;
}
OUTPUT:
first run
Enter city name:
Delhi
Enter city name again:
City name now:
Enter another city name:
Chennai
New city name:
Chennai
 The header file iomanip provides a set of functions
called manipulators which can be used to manipulate
the output formats.
 They provide the same features as that of the ios
member function and flag.
 Two or more manipulators can be,
Cout<<manip1<<manip1<<manip<<item;
Cout<<manip1<<item1<<manip2<<item2;
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
cout.setf(ios::showpoint);
cout<<setw(5)<<”n”<<setw(15)<<”inverse of
n”<<setw(15)<<”sum of terms”;
double term,sum=0;
for (int n=1;n<=10;n++)
{
term=1.0/float(n);
sum=sum + term;
cout<<setw(5)<<n<<setw(14)<<setprecision(4)<<setiosflags(ios::ss
scientific)<<term<<setw(13)<<resetioflags(ios::scientific<<sum<
<endl;
}
return 0;
}
 The large amount of Data can be handled using some
devices such as floppy disk or hard disk to store those
datas.
 These datas are stored in these devices called FILES.
 The Programs can be designed to perform the read and
write operations on those files.
 Kinds of Data Communication:
◦ Data Transfer between the console unit and the
program.
◦ Data Transfer between the program and a Diskfile.
FILEBUF:
It is used to set the file buffers to read and write.
FSTREAMBASE:
It provides operations common to the file streams.
IFSTREAM:
It provides input operations.
OFSTREAM:
It provides output operations.
FSTREAM:
It provides support for both input and output
operations.
 The I/O system contains a set of classes that define
the file handling methods.
 These includes ifstream, ofstream and fstream.
 These classes are derived from fstreambase and from
the corresponding iostream class.
 These classes are designed to manage the Disk files,
which are declared in fstream and we should include
any program in these files.
 A file stream can be declared using the classes
ifstream, ofstream and fstream that are contained in
the Header file fstream.
 A file can be Opened into two ways:
Using the Constructor function of the class
Using the Member function open() of the class
OPENING FILES USING Open():
 The function open() can be used to open multiple
files that use the same stream object.
file-stream-class stream-object;
stream-object.open (“file name”);
#include<iostream.h>
#include<fstream.h>
int main()
{
ofstream fout;
fout.open(“Country names”);
fout<<“Uniited States Of American”;
fout<<“United Kingdomn”;
fout.close();
return 0;
}
OUTPUT:
Country names
United States Of America
United Kingdom
This condition is necessary for preventing data
from the file. This condition is
MORE ABOUT OPEN( ): FILE MODES
• The ifstream and ofstream is used to create
the new files.
• The function open( ) is used to open a new
stream.
object. open(“file name”,mode);
Each file has two associated pointers known
as File pointers.
DEFAULT ACTIONS:
When we open a file in read-only-mode
,these input pointer is automatically set at the
beginning.
FUNCTIONS FOR MANIPULATION OF FILE POINTERS:
 seekg()-Moves a pointer to specified location
 seekp()-Moves put pointer to a specified location
 tellg()-Gives the current position of the get pointer
 tellp()-Gives the current position of the put pointer
It supports a number of member function for
performing the input/output operations on files.
Put() and get() Functions:
◦ It is used to handle single character at a time.
◦ The function put() writes a single character to the
associated stream.
◦ The function get() reads a single character to the
associated stream.
Write() and read() Functions:
It is used to read and write the blocks in the binary
data.
 It is used to maintain the routine task in the data file.
 The updation can be done in:
◦ Displaying the contents of a file
◦ Modifying an existing item
◦ Adding a new file
◦ Deleting an existing file
 The reading and writing files may not be true
always.
◦ A file which we are attempting to open for reading
does not exist.
◦ The file name used for a new file may already exist.
◦ We may use an invalid file name.
◦ There may not be any space in the disk for storing
more data.
◦ We may attempt to perform an operation when the
file is not opened for that purpose.
 This feature facilities the supply of arguments to the
main() function.
 These arguments are supplied at the time of invoking
the program.
◦ C> exam data results
◦ Exam is the name of the file containing the program
to be executed ,data and results are the filenames
passed to the program as command-line arguments.
THANKYOU!!!

More Related Content

What's hot

Files in c++
Files in c++Files in c++
Files in c++
NivethaJeyaraman
 
Data file handling in python binary & csv files
Data file handling in python binary & csv filesData file handling in python binary & csv files
Data file handling in python binary & csv files
keeeerty
 
08. handling file streams
08. handling file streams08. handling file streams
08. handling file streams
Haresh Jaiswal
 
File handling in C++
File handling in C++File handling in C++
File handling in C++
Hitesh Kumar
 
Filehandlinging cp2
Filehandlinging cp2Filehandlinging cp2
Filehandlinging cp2
Tanmay Baranwal
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
bhatvijetha
 
Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01
Rex Joe
 
file handling, dynamic memory allocation
file handling, dynamic memory allocationfile handling, dynamic memory allocation
file handling, dynamic memory allocation
indra Kishor
 
Functions in python
Functions in pythonFunctions in python
Functions in python
Santosh Verma
 
basics of file handling
basics of file handlingbasics of file handling
basics of file handling
pinkpreet_kaur
 
Format String
Format StringFormat String
Format String
Wei-Bo Chen
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
sudhir singh yadav
 
File Handling in C++
File Handling in C++File Handling in C++
Data file handling
Data file handlingData file handling
Data file handling
Saurabh Patel
 
Java File I/O
Java File I/OJava File I/O
Java File I/O
Canterbury HS
 
Data file handling
Data file handlingData file handling
Data file handling
TAlha MAlik
 
Input File dalam C++
Input File dalam C++Input File dalam C++
Input File dalam C++
Teguh Nugraha
 
Filehadnling
FilehadnlingFilehadnling
Filehadnling
Khushal Mehta
 
Java Input Output and File Handling
Java Input Output and File HandlingJava Input Output and File Handling
Java Input Output and File Handling
Sunil OS
 
Python - Lecture 11
Python - Lecture 11Python - Lecture 11
Python - Lecture 11
Ravi Kiran Khareedi
 

What's hot (20)

Files in c++
Files in c++Files in c++
Files in c++
 
Data file handling in python binary & csv files
Data file handling in python binary & csv filesData file handling in python binary & csv files
Data file handling in python binary & csv files
 
08. handling file streams
08. handling file streams08. handling file streams
08. handling file streams
 
File handling in C++
File handling in C++File handling in C++
File handling in C++
 
Filehandlinging cp2
Filehandlinging cp2Filehandlinging cp2
Filehandlinging cp2
 
Pipes and filters
Pipes and filtersPipes and filters
Pipes and filters
 
Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01Filesinc 130512002619-phpapp01
Filesinc 130512002619-phpapp01
 
file handling, dynamic memory allocation
file handling, dynamic memory allocationfile handling, dynamic memory allocation
file handling, dynamic memory allocation
 
Functions in python
Functions in pythonFunctions in python
Functions in python
 
basics of file handling
basics of file handlingbasics of file handling
basics of file handling
 
Format String
Format StringFormat String
Format String
 
Complete Guide for Linux shell programming
Complete Guide for Linux shell programmingComplete Guide for Linux shell programming
Complete Guide for Linux shell programming
 
File Handling in C++
File Handling in C++File Handling in C++
File Handling in C++
 
Data file handling
Data file handlingData file handling
Data file handling
 
Java File I/O
Java File I/OJava File I/O
Java File I/O
 
Data file handling
Data file handlingData file handling
Data file handling
 
Input File dalam C++
Input File dalam C++Input File dalam C++
Input File dalam C++
 
Filehadnling
FilehadnlingFilehadnling
Filehadnling
 
Java Input Output and File Handling
Java Input Output and File HandlingJava Input Output and File Handling
Java Input Output and File Handling
 
Python - Lecture 11
Python - Lecture 11Python - Lecture 11
Python - Lecture 11
 

Similar to Managing,working with files

Managing console of I/o operations & working with files
Managing console of I/o operations & working with filesManaging console of I/o operations & working with files
Managing console of I/o operations & working with files
lalithambiga kamaraj
 
Files in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for referenceFiles in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for reference
anuvayalil5525
 
streams and files
 streams and files streams and files
streams and files
Mariam Butt
 
File handling in_c
File handling in_cFile handling in_c
File handling in_c
sanya6900
 
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
AzanMehdi
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handling
pinkpreet_kaur
 
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptxObject Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
RashidFaridChishti
 
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptxObject Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
RashidFaridChishti
 
Files and streams
Files and streamsFiles and streams
Files and streams
Pranali Chaudhari
 
C_and_C++_notes.pdf
C_and_C++_notes.pdfC_and_C++_notes.pdf
C_and_C++_notes.pdf
Tigabu Yaya
 
IOStream.pptx
IOStream.pptxIOStream.pptx
IOStream.pptx
HindAlmisbahi
 
cpp-file-handling
cpp-file-handlingcpp-file-handling
cpp-file-handling
zohaib ali ali
 
Cpp file-handling
Cpp file-handlingCpp file-handling
Cpp file-handling
JiaahRajpout123
 
Basics of files and its functions with example
Basics of files and its functions with exampleBasics of files and its functions with example
Basics of files and its functions with example
Sunil Patel
 
working with files
working with filesworking with files
working with files
SangeethaSasi1
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
Haripritha
 
Lec 47.48 - stream-files
Lec 47.48 - stream-filesLec 47.48 - stream-files
Lec 47.48 - stream-files
Princess Sam
 
Java I/O
Java I/OJava I/O
working with files
working with filesworking with files
working with files
SangeethaSasi1
 
Managing console input
Managing console inputManaging console input
Managing console input
rajshreemuthiah
 

Similar to Managing,working with files (20)

Managing console of I/o operations & working with files
Managing console of I/o operations & working with filesManaging console of I/o operations & working with files
Managing console of I/o operations & working with files
 
Files in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for referenceFiles in C++.pdf is the notes of cpp for reference
Files in C++.pdf is the notes of cpp for reference
 
streams and files
 streams and files streams and files
streams and files
 
File handling in_c
File handling in_cFile handling in_c
File handling in_c
 
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
new pdfrdfzdfzdzzzzzzzzzzzzzzzzzzzzzzzzzzgggggggggggggggggggggggggggggggggggg...
 
Basics of file handling
Basics of file handlingBasics of file handling
Basics of file handling
 
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptxObject Oriented Programming using C++: Ch12 Streams and Files.pptx
Object Oriented Programming using C++: Ch12 Streams and Files.pptx
 
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptxObject Oriented Programming Using C++: Ch12 Streams and Files.pptx
Object Oriented Programming Using C++: Ch12 Streams and Files.pptx
 
Files and streams
Files and streamsFiles and streams
Files and streams
 
C_and_C++_notes.pdf
C_and_C++_notes.pdfC_and_C++_notes.pdf
C_and_C++_notes.pdf
 
IOStream.pptx
IOStream.pptxIOStream.pptx
IOStream.pptx
 
cpp-file-handling
cpp-file-handlingcpp-file-handling
cpp-file-handling
 
Cpp file-handling
Cpp file-handlingCpp file-handling
Cpp file-handling
 
Basics of files and its functions with example
Basics of files and its functions with exampleBasics of files and its functions with example
Basics of files and its functions with example
 
working with files
working with filesworking with files
working with files
 
programming language in c&c++
programming language in c&c++programming language in c&c++
programming language in c&c++
 
Lec 47.48 - stream-files
Lec 47.48 - stream-filesLec 47.48 - stream-files
Lec 47.48 - stream-files
 
Java I/O
Java I/OJava I/O
Java I/O
 
working with files
working with filesworking with files
working with files
 
Managing console input
Managing console inputManaging console input
Managing console input
 

More from kirupasuchi1996

Rotor machine,subsitution technique
Rotor machine,subsitution techniqueRotor machine,subsitution technique
Rotor machine,subsitution technique
kirupasuchi1996
 
rotor machine
rotor machinerotor machine
rotor machine
kirupasuchi1996
 
DVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSION
DVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSIONDVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSION
DVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSION
kirupasuchi1996
 
Cyper crime
Cyper crimeCyper crime
Cyper crime
kirupasuchi1996
 
DS ppt
DS pptDS ppt
Image compression standards
Image compression standardsImage compression standards
Image compression standards
kirupasuchi1996
 
Language and Processors for Requirements Specification
Language and Processors for Requirements SpecificationLanguage and Processors for Requirements Specification
Language and Processors for Requirements Specification
kirupasuchi1996
 
Software Cost Factor
Software Cost FactorSoftware Cost Factor
Software Cost Factor
kirupasuchi1996
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
kirupasuchi1996
 
Designing Techniques in Software Engineering
Designing Techniques in Software EngineeringDesigning Techniques in Software Engineering
Designing Techniques in Software Engineering
kirupasuchi1996
 
Dmppt 180312092027
Dmppt 180312092027Dmppt 180312092027
Dmppt 180312092027
kirupasuchi1996
 
Datatransferandmanipulation 180214044522
Datatransferandmanipulation 180214044522Datatransferandmanipulation 180214044522
Datatransferandmanipulation 180214044522
kirupasuchi1996
 
Filesharing 180214044607
Filesharing 180214044607Filesharing 180214044607
Filesharing 180214044607
kirupasuchi1996
 
B tree-180214044656
B tree-180214044656B tree-180214044656
B tree-180214044656
kirupasuchi1996
 
Addressingmodes
Addressingmodes Addressingmodes
Addressingmodes
kirupasuchi1996
 

More from kirupasuchi1996 (15)

Rotor machine,subsitution technique
Rotor machine,subsitution techniqueRotor machine,subsitution technique
Rotor machine,subsitution technique
 
rotor machine
rotor machinerotor machine
rotor machine
 
DVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSION
DVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSIONDVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSION
DVI,FRACTAL IMAGE,SUB BAND IMAGE,VIDEO CODING AND WAVELET BASED COMPRESSION
 
Cyper crime
Cyper crimeCyper crime
Cyper crime
 
DS ppt
DS pptDS ppt
DS ppt
 
Image compression standards
Image compression standardsImage compression standards
Image compression standards
 
Language and Processors for Requirements Specification
Language and Processors for Requirements SpecificationLanguage and Processors for Requirements Specification
Language and Processors for Requirements Specification
 
Software Cost Factor
Software Cost FactorSoftware Cost Factor
Software Cost Factor
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
Designing Techniques in Software Engineering
Designing Techniques in Software EngineeringDesigning Techniques in Software Engineering
Designing Techniques in Software Engineering
 
Dmppt 180312092027
Dmppt 180312092027Dmppt 180312092027
Dmppt 180312092027
 
Datatransferandmanipulation 180214044522
Datatransferandmanipulation 180214044522Datatransferandmanipulation 180214044522
Datatransferandmanipulation 180214044522
 
Filesharing 180214044607
Filesharing 180214044607Filesharing 180214044607
Filesharing 180214044607
 
B tree-180214044656
B tree-180214044656B tree-180214044656
B tree-180214044656
 
Addressingmodes
Addressingmodes Addressingmodes
Addressingmodes
 

Recently uploaded

Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google CloudRadically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
ScyllaDB
 
Building a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data PlatformBuilding a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data Platform
Enterprise Knowledge
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
ScyllaDB
 
Cyber Recovery Wargame
Cyber Recovery WargameCyber Recovery Wargame
Cyber Recovery Wargame
Databarracks
 
Real-Time Persisted Events at Supercell
Real-Time Persisted Events at  SupercellReal-Time Persisted Events at  Supercell
Real-Time Persisted Events at Supercell
ScyllaDB
 
ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes
 
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to SuccessMongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
ScyllaDB
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
manji sharman06
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
Neeraj Kumar Singh
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
zjhamm304
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
Cynthia Thomas
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
Tobias Schneck
 
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
anilsa9823
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
Ortus Solutions, Corp
 
So You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental DowntimeSo You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental Downtime
ScyllaDB
 
New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024
ThousandEyes
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
ScyllaDB
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
UiPathCommunity
 
Introduction to ThousandEyes AMER Webinar
Introduction  to ThousandEyes AMER WebinarIntroduction  to ThousandEyes AMER Webinar
Introduction to ThousandEyes AMER Webinar
ThousandEyes
 
APJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes WebinarAPJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes Webinar
ThousandEyes
 

Recently uploaded (20)

Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google CloudRadically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
Radically Outperforming DynamoDB @ Digital Turbine with SADA and Google Cloud
 
Building a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data PlatformBuilding a Semantic Layer of your Data Platform
Building a Semantic Layer of your Data Platform
 
An All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS MarketAn All-Around Benchmark of the DBaaS Market
An All-Around Benchmark of the DBaaS Market
 
Cyber Recovery Wargame
Cyber Recovery WargameCyber Recovery Wargame
Cyber Recovery Wargame
 
Real-Time Persisted Events at Supercell
Real-Time Persisted Events at  SupercellReal-Time Persisted Events at  Supercell
Real-Time Persisted Events at Supercell
 
ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024ThousandEyes New Product Features and Release Highlights: June 2024
ThousandEyes New Product Features and Release Highlights: June 2024
 
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to SuccessMongoDB to ScyllaDB: Technical Comparison and the Path to Success
MongoDB to ScyllaDB: Technical Comparison and the Path to Success
 
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
Call Girls Chandigarh🔥7023059433🔥Agency Profile Escorts in Chandigarh Availab...
 
Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0Chapter 5 - Managing Test Activities V4.0
Chapter 5 - Managing Test Activities V4.0
 
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...QA or the Highway - Component Testing: Bridging the gap between frontend appl...
QA or the Highway - Component Testing: Bridging the gap between frontend appl...
 
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My IdentityCNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
CNSCon 2024 Lightning Talk: Don’t Make Me Impersonate My Identity
 
Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!Containers & AI - Beauty and the Beast!?!
Containers & AI - Beauty and the Beast!?!
 
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
Call Girls Chennai ☎️ +91-7426014248 😍 Chennai Call Girl Beauty Girls Chennai...
 
Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!Introducing BoxLang : A new JVM language for productivity and modularity!
Introducing BoxLang : A new JVM language for productivity and modularity!
 
So You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental DowntimeSo You've Lost Quorum: Lessons From Accidental Downtime
So You've Lost Quorum: Lessons From Accidental Downtime
 
New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024New ThousandEyes Product Features and Release Highlights: June 2024
New ThousandEyes Product Features and Release Highlights: June 2024
 
Discover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched ContentDiscover the Unseen: Tailored Recommendation of Unwatched Content
Discover the Unseen: Tailored Recommendation of Unwatched Content
 
Automation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI AutomationAutomation Student Developers Session 3: Introduction to UI Automation
Automation Student Developers Session 3: Introduction to UI Automation
 
Introduction to ThousandEyes AMER Webinar
Introduction  to ThousandEyes AMER WebinarIntroduction  to ThousandEyes AMER Webinar
Introduction to ThousandEyes AMER Webinar
 
APJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes WebinarAPJC Introduction to ThousandEyes Webinar
APJC Introduction to ThousandEyes Webinar
 

Managing,working with files

  • 3. Ios: It contains basic facilities that are used by all other input and output classes. Istream: It inherites the properties of ios and it declares input functions such as get(),getline() and read(). Ostream: It inherites the properties of ios and it declares output functions such as put() and write(). Iostream: It inherites the properties of ios stream and ostream. Streambuf: It provides an interface to physical devices through buffers.
  • 4. The features that supports to format the console I/O operations are: ◦ Ios class functions and flags ◦ Manipulators ◦ User-defined output functions IOS CLASS FUNCTIONS AND FLAGS: It consists of large number of member functions that is used to format the output in number of ways.
  • 5.  MANIPULATORS: These are the special functions that are included in the I/O statements to format the parameters of a stream.  DEFINING FIELD WIDTH: ◦ It is used to define the width of the field. ◦ Can be defined using width(); SETTING PRECISION: It is used to specify the to be displayed after the decimal point. FILLING AND PADDING:  It is used to print the values using the larger field widths.  It can be declared by, cout.fill();
  • 6. #include <iostream> using namespace std; int main() { int item[4] ={ 10,8,12,15}; int cost[4]={75,100,60,99}; cout.width(5); cout<<”Items”; cout.width(8); cout<<”Cost”;
  • 7. cout.width(15); cout<<”Total Value”<<”n”; int sum=0; for(int i=0;i<4 ;i++) { cout.width(5); cout<<items[i]; cout.width(8); cout<<cost[i]; int value = items[i] * cost[i]; cout.width(15);
  • 8. cout<<value<<”n”; sum= sum + value; } cout<<”n Grand total = “; cout.width(2); cout<<sum<<”n”; return 0; }
  • 9. OUTPUT: ITEMS COST TOTAL VALUE 10 75 750 8 100 800 12 60 720 15 99 1485 Grand total =3755
  • 10. It is used for defining the input and output in various forms. Overloaded Operators >> and <<: • It is used to give the I/O • The >> is overloaded in istream class • The << is overloaded in ostream class Ex: cin>>item1>>item2;
  • 11. put() and get() Functions: ◦ It is used for the input and output . ◦ Put(c) is used to give the input ◦ Get(c) is used to get the output EXAMPLE: #include <iostream> using namespace std; int main() { int count=0; char c; cout<<”INPUT TEXT n”; cin.get( c ); while ( c 1=’n’ )
  • 12. while ( c 1=’n’ ) { cout.put( c); count++; cin.get( c ); } cout<< “n Number of characters =” <<count <<”n”; return 0; } OUTPUT: Object oriented programming Number of characters=27
  • 13. Getline() and write() Functions: • The getline() function reads a whole line of the text and ends with a newline character. • This function can be invoked by, cin.getline (line,size); • The writeline() function reads a whole line of the text and displays an entire line. • This function can be invoked by, cout.write (line,size);
  • 14. EXAMPLE: #include <iostream> using namespace std; int main() { int size=20; char city[20]; cout<<”enter city name:n “; cin>>city; cout<<”city name:”<<city<<”nn”; cout<<”enter city name again: n”; cin.getline(city,size);
  • 15. cout<<”city name now:”<<city<<”nn”; cout<<”enter another city name: n”; cin.getline(city,size); cout <<”New city name:”<<city<<”nn’; return 0; }
  • 16. OUTPUT: first run Enter city name: Delhi Enter city name again: City name now: Enter another city name: Chennai New city name: Chennai
  • 17.  The header file iomanip provides a set of functions called manipulators which can be used to manipulate the output formats.  They provide the same features as that of the ios member function and flag.  Two or more manipulators can be, Cout<<manip1<<manip1<<manip<<item; Cout<<manip1<<item1<<manip2<<item2;
  • 18. #include<iostream> #include<iomanip> using namespace std; int main() { cout.setf(ios::showpoint); cout<<setw(5)<<”n”<<setw(15)<<”inverse of n”<<setw(15)<<”sum of terms”; double term,sum=0; for (int n=1;n<=10;n++)
  • 20.  The large amount of Data can be handled using some devices such as floppy disk or hard disk to store those datas.  These datas are stored in these devices called FILES.  The Programs can be designed to perform the read and write operations on those files.  Kinds of Data Communication: ◦ Data Transfer between the console unit and the program. ◦ Data Transfer between the program and a Diskfile.
  • 21.
  • 22. FILEBUF: It is used to set the file buffers to read and write. FSTREAMBASE: It provides operations common to the file streams. IFSTREAM: It provides input operations. OFSTREAM: It provides output operations. FSTREAM: It provides support for both input and output operations.
  • 23.  The I/O system contains a set of classes that define the file handling methods.  These includes ifstream, ofstream and fstream.  These classes are derived from fstreambase and from the corresponding iostream class.  These classes are designed to manage the Disk files, which are declared in fstream and we should include any program in these files.
  • 24.  A file stream can be declared using the classes ifstream, ofstream and fstream that are contained in the Header file fstream.  A file can be Opened into two ways: Using the Constructor function of the class Using the Member function open() of the class OPENING FILES USING Open():  The function open() can be used to open multiple files that use the same stream object. file-stream-class stream-object; stream-object.open (“file name”);
  • 25. #include<iostream.h> #include<fstream.h> int main() { ofstream fout; fout.open(“Country names”); fout<<“Uniited States Of American”; fout<<“United Kingdomn”; fout.close(); return 0;
  • 26. } OUTPUT: Country names United States Of America United Kingdom
  • 27. This condition is necessary for preventing data from the file. This condition is MORE ABOUT OPEN( ): FILE MODES • The ifstream and ofstream is used to create the new files. • The function open( ) is used to open a new stream. object. open(“file name”,mode);
  • 28. Each file has two associated pointers known as File pointers. DEFAULT ACTIONS: When we open a file in read-only-mode ,these input pointer is automatically set at the beginning. FUNCTIONS FOR MANIPULATION OF FILE POINTERS:  seekg()-Moves a pointer to specified location  seekp()-Moves put pointer to a specified location  tellg()-Gives the current position of the get pointer  tellp()-Gives the current position of the put pointer
  • 29. It supports a number of member function for performing the input/output operations on files. Put() and get() Functions: ◦ It is used to handle single character at a time. ◦ The function put() writes a single character to the associated stream. ◦ The function get() reads a single character to the associated stream. Write() and read() Functions: It is used to read and write the blocks in the binary data.
  • 30.  It is used to maintain the routine task in the data file.  The updation can be done in: ◦ Displaying the contents of a file ◦ Modifying an existing item ◦ Adding a new file ◦ Deleting an existing file
  • 31.  The reading and writing files may not be true always. ◦ A file which we are attempting to open for reading does not exist. ◦ The file name used for a new file may already exist. ◦ We may use an invalid file name. ◦ There may not be any space in the disk for storing more data. ◦ We may attempt to perform an operation when the file is not opened for that purpose.
  • 32.  This feature facilities the supply of arguments to the main() function.  These arguments are supplied at the time of invoking the program. ◦ C> exam data results ◦ Exam is the name of the file containing the program to be executed ,data and results are the filenames passed to the program as command-line arguments.
  翻译: