我正在尝试使用 getline 解析文档以获取整行并将其放在名为“line”的字符串变量中。问题是我收到一条错误消息:“没有重载函数 getline 的实例与参数列表匹配。” 谁能帮我解决这个问题?
#include <iostream>
#include <fstream>
#include <string>
#include "recordsOffice.h"
using namespace std;
RecordsOffice::RecordsOffice()
{
}
void RecordsOffice::parseCommands (string commandsFileName)
{
//String to hold a line from the file
string line;
//Open the file
ifstream myFile;
myFile.open(commandsFileName);
// Check to make sure the file opened properly
if (!myFile.is_open())
{
cout << "There was an error opening " << commandsFileName << "." << endl;
return;
}
//Parse the document
while (getline(myFile, line, '/n'))
{
if (line[0] == 'A')
{
addStudent(line);
}