क्या कोई बफर की अवधारणा को और अधिक स्पष्ट रूप से समझा सकता है? मैं समझता हूं कि बफर डेटा संरचनाएं हैं जहां वर्ण संग्रहीत किए जाते हैं, और वह जगह जहां डेटा को पढ़ना है। बफर फ्लश करने का विचार क्या है?सी ++ cout और cin buffers, और सामान्य में बफर
जब एक बफर फ़्लश किया जाता है, तो क्या इसमें संग्रहीत वर्ण लिखने के कार्य का जिक्र है?
पाठ से:
To avoid the overhead of writing in response to each output request, the library uses the
buffer to accumulate the characters to be written, and flushes the buffer, by writing its
contents to the output device, only when necessary. By doing so, it can combine several
output operations into a single write.
जब 'फ्लशिंग' है कि लगभग यह ध्वनि के रूप में यदि बफर लिखा जा रहा है, लेकिन यह भी एक ही समय में मिट बनाता का जिक्र है। बस अटकलें।
तो, स्क्रीन पर देखने के लिए लिखा जाने के लिए बफर फ्लश की आवश्यकता है?
When our program writes its prompt to cout, that output goes into the buffer associated
with the standard output stream. Next, we attempt to read from cin. This read flushes
the cout buffer, so we are assured that our user will see the prompt.
यहाँ, यह लग रहा है जैसे कि अंत में 'endl' का उपयोग करके यह प्रणाली इसे तुरंत लिखने के लिए की जरूरत है बताता है (हैं जिसका अर्थ है अन्यथा नहीं?) Endl क्या नहीं किया जाता है है?
Writing the value of std::endl ends the line of
output, and then flushes the buffer, which forces the system to write to the output
stream immediately.
इस प्रश्न से पूछा गया है और SO में बहुत समय का उत्तर दिया गया है। http://stackoverflow.com/a/4752069/1155650 –