Home arrow C++ arrow Advanced File Handling with Streams in C++
C++

Advanced File Handling with Streams in C++


In the previous article of this series, titled "File Handling and Streams in C++," you saw how to handle files in an easy and convenient way. Getting input data from a file or putting such data into a file should be familiar to you now. In this article, we'll take a look at some more advanced tasks and tricks so you can gain speed and efficiency in your work.

Author Info:
By: Gabor Bernat
Rating: 5 stars5 stars5 stars5 stars5 stars / 7
April 14, 2009
TABLE OF CONTENTS:
  1. · Advanced File Handling with Streams in C++
  2. · Printing from Containers
  3. · Reading Inside a Container
  4. · Writing to Two Streams

print this article
SEARCH DEVARTICLES

Advanced File Handling with Streams in C++
(Page 1 of 4 )

From time to time, I will not use streams, as I sometimes prefer the console output, although, as you may know already, that also is handled like a file, so every trick that works on the console IO will compile and run just as well on files. For this article, a minimal knowledge of STL containers and iterators and how they work is necessary.

I won't promise that I'm going to present every little trick, but I will try to show and discuss a few interesting ones. The stream part already forms a pretty strong basis for programming for anyone, but as you will see, once we combine it with some algorithms (found inside the <algorithm> header) it will be even simpler to use, and offer more.

First, let me point out that, as with any stream, the manipulators will work also with the files. If you have not heard about them in general, or how you should handle/use them, please search for my articles covering it. I dedicated two separate articles to the topic, and both of them have appeared (if not, then they are queued) here on the Developer Shed Network.


blog comments powered by Disqus
C++ ARTICLES

- Intel Threading Building Blocks
- Threading Building Blocks with C++
- Video Memory Programming in Text Mode
- More Tricks to Gain Speed in Programming Con...
- Easy and Efficient Programming for Contests
- Preparing For Programming Contests
- Programming Contests: Why Bother?
- Polymorphism in C++
- Overview of Virtual Functions
- Inheritance in C++
- Extending the Basic Streams in C++
- Using Stringstreams in C++
- Custom Stream Manipulation in C++
- General Stream Manipulation in C++
- Serialize Your Class into Streams in C++

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials