C++ iostream Library (C++ iostream लाइब्रेरी)

The iostream library is one of the most important standard libraries in C++. It provides input and output functionality using streams, allowing programs to communicate with the keyboard, monitor, files, and other devices in an efficient and object-oriented manner.
iostream C++ की सबसे महत्वपूर्ण Standard Libraries में से एक है। यह Streams की सहायता से इनपुट एवं आउटपुट (Input/Output) की सुविधा प्रदान करती है। इसकी मदद से प्रोग्राम कीबोर्ड, मॉनिटर, फाइल तथा अन्य डिवाइसों के साथ आसानी से डेटा का आदान-प्रदान कर सकता है।
What is the iostream Library? (iostream लाइब्रेरी क्या है?)
The iostream library is an object-oriented library that provides input and output operations through streams. It contains predefined classes and objects such as cin, cout, cerr, and clog, which are commonly used in C++ programs.
iostream एक Object-Oriented Library है, जो Streams के माध्यम से Input एवं Output से संबंधित कार्य करती है। इसमें cin, cout, cerr तथा clog जैसे पूर्व-निर्धारित (Predefined) ऑब्जेक्ट उपलब्ध होते हैं, जिनका उपयोग लगभग प्रत्येक C++ प्रोग्राम में किया जाता है।
Components of the iostream Library (iostream लाइब्रेरी के प्रमुख अवयव)
The standard iostream library contains the following components:
Standard iostream लाइब्रेरी में निम्नलिखित प्रमुख अवयव (Components) होते हैं:
Basic Class Templates (मूलभूत क्लास टेम्पलेट्स)
Class Template Instantiations (क्लास टेम्पलेट के इंस्टेंस)
Standard Objects (स्टैण्डर्ड ऑब्जेक्ट्स)
Data Types (डेटा प्रकार)
Manipulators (मैनीपुलेटर्स)
Important Header Files of the iostream Library (iostream लाइब्रेरी की महत्वपूर्ण हेडर फाइलें)
1.
<iostream>The
<iostream> header defines the standard input and output stream objects such as cin, cout, cerr, and clog. It is the most commonly used header file in C++ programming.<iostream> हेडर फाइल cin, cout, cerr तथा clog जैसे स्टैण्डर्ड इनपुट एवं आउटपुट ऑब्जेक्ट्स को परिभाषित करती है। यह C++ की सबसे अधिक उपयोग की जाने वाली हेडर फाइल है।2.
<ios>, <istream>, <ostream>, and <streambuf>These header files define the base classes of the C++ stream hierarchy. Other stream classes, including those in
<iostream>, are derived from these base classes.These classes provide the foundation for standard input and output operations.
<ios>, <istream>, <ostream> तथा <streambuf> C++ की Stream Hierarchy की मूल (Base) क्लासों को परिभाषित करती हैं। <iostream> सहित अन्य स्ट्रीम क्लासें इन्हीं बेस क्लासों से विरासत (Inheritance) प्राप्त करती हैं।ये क्लासें स्टैण्डर्ड इनपुट एवं आउटपुट संचालन की आधारशिला (Foundation) हैं।
3.
<fstream>The
<fstream> header provides classes for file handling in C++. It includes classes such as:ifstream – Reads data from a file.
ofstream – Writes data to a file.
fstream – Performs both input and output operations on files.
These classes make file handling simple and efficient using streams.
<fstream> हेडर फाइल C++ में File Handling के लिए उपयोग की जाती है। इसमें मुख्य रूप से निम्न क्लासें उपलब्ध होती हैं—ifstream – फाइल से डेटा पढ़ने के लिए।
ofstream – फाइल में डेटा लिखने के लिए।
fstream – फाइल में पढ़ने एवं लिखने दोनों कार्यों के लिए।
इन क्लासों की सहायता से स्ट्रीम के माध्यम से फाइलों का सरल एवं प्रभावी ढंग से उपयोग किया जाता है।
4.
<sstream>The
<sstream> header provides classes for performing input and output operations on string objects using streams.It includes classes such as stringstream, istringstream, and ostringstream.
<sstream> हेडर फाइल का उपयोग String Objects पर स्ट्रीम आधारित इनपुट एवं आउटपुट संचालन करने के लिए किया जाता है।इसमें मुख्य रूप से stringstream, istringstream तथा ostringstream क्लासें उपलब्ध होती हैं।
5.
<iomanip>The
<iomanip> header provides formatting functions known as Manipulators, which help display output in a more readable and professional format.<iomanip> हेडर फाइल आउटपुट को आकर्षक एवं व्यवस्थित बनाने के लिए विभिन्न Manipulators प्रदान करती है।Some commonly used manipulators are: इसके कुछ प्रमुख Manipulators हैं—
endl
setw()
setfill()
setprecision()
fixed
left
right
इनका उपयोग आउटपुट को उचित चौड़ाई, दशमलव स्थान, संरेखण (Alignment) तथा अन्य फॉर्मेट में प्रदर्शित करने के लिए किया जाता है।
Conclusion (निष्कर्ष)
The iostream library is the foundation of input and output operations in C++. It provides various header files, classes, objects, and manipulators that make communication with users, files, and strings simple and efficient. Every C++ programmer should have a good understanding of the iostream library before learning advanced C++ concepts.
iostream लाइब्रेरी C++ में Input एवं Output संचालन की आधारशिला है। यह विभिन्न हेडर फाइलों, क्लासों, ऑब्जेक्ट्स तथा Manipulators के माध्यम से उपयोगकर्ता, फाइल एवं स्ट्रिंग के साथ डेटा का आदान-प्रदान सरल एवं प्रभावी बनाती है। इसलिए प्रत्येक C++ प्रोग्रामर के लिए iostream लाइब्रेरी का ज्ञान अत्यंत आवश्यक है।
Comments
Post a Comment