Hi, I am currently having trouble to have getline to read line from the file.
Error is: "no instance of overloaded function "getline" matches the argument list"
code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12
std::ifstream config("config.txt");
string process[4];
int linecount = 1;
if (config.is_open)
{
while (config.peek() !=EOF)
{
getline(config, process);
linecount++;
}
}
I actually want to store the contents of each line in a reused array
My file will look something like this:
chrome,1,3,high
so I want to store the name in Process[1] and so on...
so how do I get it to read the line then split the values into the array after each comma
and reiterate with every line?
One should not use bad form, even when it's not the main point being illustrated. Especially since it sets a bad example.
The habit of always being correct and not cutting corners is a good one, and helps create better products when one is under pressure of a looming deadline.
Indicating "bad form" up-front is not an excuse, that's just laziness.