I was working on some basic code but had problems with my getline() function. I was using a while loop to go through a stringstream like this:
    while (N > -1){
        getline(cin, s);
        stringstream ss(s);
        
      while (getline(ss, n, ",")){
            num.push_back(n); 
      }   
I always go this warning saying “no instance of overloaded function “getline” matches the argument list —- argument types are:(std::stringstream, int, const char[2])”
I thought it was my code that was the problem, but when I tried copying and pasting Geeks for geeks code into visual studio code I got a similar message.
Here’s their code:
#include <bits/stdc++.h> 
using namespace std; 
  
int main() 
{ 
    string str = "1, 2, 3, 4, 5, 6"; 
    vector<string> v; 
  
    stringstream ss(str); 
  
    while (ss.good()) { 
        string substr; 
        getline(ss, substr, ', '); 
        v.push_back(substr); 
    } 
  
    for (size_t i = 0; i < v.size(); i++) 
        cout << v[i] << endl; 
}
I’ve also seen a YouTuber, Derek Banas, do something similar in his recent C++ tutorial. When I try to copy him, I always get an error.
I’m not sure what I’m doing wrong.
