I don't know if I'm reading this correctly, but it looks like you are trying to sort all of the lines in your file. I have a suggestion if this is the case.
Are you familiar with the std::map data structure? If the data after Cap900 is what you want to match to, you could create a map that uses that string as a key, either by hashing that string to an integer value (ex: using a hash you can find here) or by using the full string as the hash though I think it might be slower. Something like this:
// ... other code up here ...
string original;
getline(inFile, original, '\0');
int hash = FuncThatHashesAString(original);
std::map<int, std::vector<string> > lineMap;
// indexing into the map at a location will either return a reference to a vector or create a new one that is empty
lineMap[hash].push_back(original);
// afterwards you can print out each line in order using a loop like this
auto it = lineMap.begin();
for(; it != lineMap.end(); ++it)
{
for(unsigned i = 0; i < it->second.size(); ++i)
{
string strOriginal = it->second[i];
// then print your string to a new file if you want
}
}
Of course this is adding the full line though, you would need to parse your data first before using it as the hash. I think you would also want to add the full line to the map as well, not just the data to the right of Cap900. Let me know if this helps you!