Quote Originally Posted by MK27 View Post
Yeah, grokking documentation is the same as programming: the more you do it, the easier it becomes.

Usually what docs lack are working examples. Here's something that reads a text file into a vector of strings, then prints them out:
Code:
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;

int main() {
	string name="tmp.txt";
	ifstream file(name.c_str());
	char buf[1024];
	vector<string> data;
	int i, len;

	while (file.getline(buf,1024)) data.push_back(buf);

       	file.close();
                 
	len = data.size();
	for (i=0;i<len;i++) cout << data[i] << endl;

	return 0;
}
I rarely will recommend a programming book b/c frankly most have about 10% useful material. However I would suggest taking a peek at this:
Amazon.com: The C++ Standard Library: A Tutorial and Reference (0785342379266): Nicolai M. Josuttis: Books

Because it is chock-full of both theory AND working examples showing how things work. I really like it. A senior dev gave this book to me one year for a gift and I find it be one of the most useful non-platform-specific coding books that I own...

In the related books dept, speaking of something with lots of example code, seek out this baby:



Edit: Nuts..in edit mode the URL is there in the proper tags but published it is not. Anyhow the name is the Oreilly C++ Cookbook.
End edit.
What makes this one good is if you want to skip theory (like trying to get things done on a deadline) and just quickly need a working example of how to do programming job XXX, this "cookbook" is great, just short chapters with "recipes" for doing everything from debugging to using Boost to whatever. Good stuff.