I am trying to figure this problem out, for some reason I keep getting this:
no instance of "getline" matches the argument list.
I have looked up this problem and a lot of times its because people use ofstream, or they don't use the ifstream object (if I said that right) has the first attribute to getline. I am quite lost.
#include <string>
std::wifstream myfile;
myfile.open("LaunchLocations.txt");
getline(myfile, gameLaunchtest.directory);
struct gameLaunch
{
wchar_t directory[MAX_PATH];
wchar_t AppName[MAX_PATH];
wchar_t ComboBoxName[MAX_PATH];
}gameLaunchtest;
std::getline()
does not support reading into a wchar_t[]
array, only into a std::string
or std::wstring
(depending on the input stream type). To read into a wchar_t[]
, you need to use the std::wifstream::getline()
method instead:
myfile.getline(gameLaunchtest.directory, MAX_PATH);