Filter = where clause in sql, sort = sort in sql, it doesn't really matter.
MySQL can be installed on a Windows box.
The only thing I can see using C++ for is changing all the spaces in the text files to line feeds (so each row is a word), but there's probably easier ways to do that too.
Edit - MySQL has tools for this, as does Oracle and I'm assuming SQL Express likely does too:
http://dev.mysql.com/doc/refman/5.0/en/load-data.html
http://dev.mysql.com/doc/refman/5.0/en/mysqlimport.html
I'm sure you're interested in learning C++ or something but this really seems like re-inventing the wheel. Perhaps you're some kind of Uber Programming Personage but it seems doubtful that you're going to come up with something which is more optimized that a database w/ query parser/execution.
Also in your posted code you tested that the input file opened successfully but you didn't check that your output file did.



