I need to read a csv file into 4 arrays or vectors. With each array containing a column from the file. It's a very simple file. There is just the content itself separated by commas and new lines probably with \n.
So it's something like just getting a line at a time and splitting it by commas. The first split goes into the first array, second to second array, ect.
But I'm extremely new to programming so I'm hoping for help for implementing a simple solution.
There may be more than 4 columns in the file but I only need to use the first 4. That shouldn't even change the code at all I don't think. Also there are no headers or other nonsense :)
Any help appreciated, thank you. All googled solutions are so complited, probably because they are trying to support the whole csv standard. But for my purposes I just need something very simple. That's why I'm asking. Thanks.
I'm just guessing. But maybe putting getline into string. Searching string for location of first comma. And then somehow putting the range of the first occurance to the first array. And so on 4 times.
Bear in mind I haven't coded yet with c++ or any language, I've just spent a few days learning it. And I spent too much time focusing on OOP, which was really good to finally learn. But I must have negleted other stuff since I can't solve this without at least wanting to ask others first.