2

I'm getting an error saying no matching function for call to 'getline' involving the getline(tokenizer, " "); Im not sure how to fix this, Ive tried including some other headers but I just keep coming up with more errors.

#include <iostream>
#include <fstream>
#include <cstring>
#include <sstream>
#include <string>


using namespace std;

char encrypt(char character, int offset);

int main(int argc, char *argv[]) {

ifstream inputFile;
string str;
string token;
bool debug = true;
int lineLength = 0, offset;

inputFile.open(argv[1]);
if (inputFile.fail())
    cout << "File failed to open. \n";

istringstream tokenizer(str);
getline(tokenizer, " ");
offset = token.length();

while (getline(inputFile, str)){
    lineLength = str.length();

    for (int i = 0; i < lineLength; i++)
        str.at(i) = encrypt(str.at(i), offset);

    cout << str << endl;
}

inputFile.close();
return(0);
}
Reaper GM
  • 53
  • 1
  • 7
  • Please correct yourcode formatting. Doing this you will increase your chancesof getting answer. – rtruszk Dec 07 '14 at 00:24
  • sorry that its not perfect, but if you took the time to look at this, and then instead of offering any help, criticized someone who obviously is learning to code... please refrain from commenting. – Reaper GM Dec 07 '14 at 00:46
  • First post of every new user is reviewed by few more experienced users. I was one of reviewers. I don't know answer to your question but I spotted wrong formatting and gave you advice. Sometimes I am editing myself while reviewing post but this time I choosed commenting. Don't take it personally. It was only advice. – rtruszk Dec 07 '14 at 01:13
  • `std::getline()` is a function that reads a line from the stream into a `std::string` object. `getline(tokenizer, " ")` is wrong because it requires a `std::string` to read into. – David G Dec 10 '14 at 01:04

0 Answers0