|I need the function to go through this route because I'm programing in win32 api unicode|
That's probably a bad idea.
If your text file is ANSI, then use the ANSI WinAPI functions. No need to use the Unicode version if you're not going to use Unicode strings. Let Windows do the conversion for you.
Remember that all WinAPI functions which take strings come in 3 forms:
1) TCHAR form --- normal function name:
2) wide (wchar_t) form --- add a 'W' at the end of the file name:
3) narrow/ANSI (char) form --- add an 'A' to the end of the file name:
If you are using wchar_t's, you should
be calling the 'W' version of the function. Although you probably are using the TCHAR version by mistake. Break that habit. Only use the TCHAR version if you are using TCHARs.
With this you can simplify what you're doing greatly, and just pass the normal strings to the 'A' WinAPI functions.
Anyway... that's the solution I recommend. Simpler and "the right thing to do". That said... as for your actual question:
|Now I'm having the problem that every wchar_t* variable in my vector is equal to the last input retrieved from getline. I'm assuming that's because of pass-by-reference due to all the pointers.|
Pointers are not strings. They're pointers. If you have a wchar_t* that doesn't mean you have a string.
wchar_t*'s typically point to an array of wide characters. This array is the string. If you want multiple strings, you will need to have multiple arrays, with each pointer pointing to a different array.
Or... you can just use strings and not deal with arrays or pointers.
will work for wide characters... but if you go with my previous advice you can just use the normal
and not deal with wide characters at all.