vendredi 22 novembre 2019

C++ getline() generates errors even though the syntax is (presumably) correct

I think my syntax is correct, but Visual Studio isn't letting me use getline. For example,if I try

#include "pch.h"
#include<iostream>
#include<string>

using namespace std;

        int main()

            {
                string state;
                string test;
                ifstream file;

                test = " Hello, this is a \n multiline file.";
                getline(state, test);
            }
    }

the getline statement generates the error : Severity Code Description Project File Line Suppression State Error (active) E0304 no instance of overloaded function "getline" matches the argument list

Aucun commentaire:

Enregistrer un commentaire