why is it that I'm only calling dir.push_back once, yet I have 2 elements?
What we see in code statically and what the actual flow of the code happens to be are two different things. You have 2 elements because you have 2 elements. That is what you did, and that is what was done. I don't know what else to tell you. Maybe you should debug your code to figure this out. All I see is that "dir" just pops out of nowhere into your code, without any indication where it was declared, where it came from, what accessed it previously, etc.
Sure I see only one call to push_back, but how do I know if it is done once, twice, or twenty times when the program is run? You don't have a full program posted, so no one knows, how, when, or where these functions are called, or with what data they are being called with.
How do you know there is an element at dir? Accessing non-existent elements in an array or vector using  leads to undefined behaviour.
Last edited by Paul McKenzie; January 10th, 2013 at 02:29 PM.
This goes back to your other discussion thread 'TCHAR correct usage'. Why are you using StringVector as a function argument when you are only returning a single name? As per the other thread, why not use string& dir as a function parameter?
A word to the wise. Do you know what your program is trying to do before you start to code it? is this documented? Have you designed it before starting to code? Have you defined AND DOCUMENTED what functions are required and their interfaces? Programming is a lot more than just coding. In your code might I suggest that you insert comments before each function describing what it is supposed to do, what it returns and the purpose of each of its parameters, whether they are [in] only, [out] only or both [in/out], any assumptions made about the value(s) of the [in] parameters, the state of the [out] parameters if an error occurs etc etc etc. Time spent on documentation is time well spent. Others trying to understand your code have an idea of what it should be doing and when you come back to your code in a week/month/year's time and you're forgotten what you did and why then the comments will help - also helps when trying to use a function. The interfaces to a function should be the simplest that is needed to full fill its purpose which should be only one thing.
You might find it helpful to read 'Problem Solving, Abstraction & Design Using c++' by Friedman and Koffman. Especially sections 1.5, 1.6 and chapter 6 regarding program design. If you can't find a copy in a library, Amazon UK have the 2000 version used for £1.96 (Plus p&p).