#include <vector>
#include <cstdlib>
#include <iostream>
#include <algorithm>
#include <string>
#include <fstream>
#include <stdlib.h>
using namespace std;
•
• //main func declaration etc...
•
//Vectors for storing information from file
vector<string> include;
vector<string> exclude;
string temp; //for storing whatever the stream is on
int len = atoi(puzzle_file >> temp); //first pos
int width = atoi(puzzle_file >> temp); //second pos
The above code is supposed to read in a file and store the numbers in the corresponding ints. I'm getting an error that says "no matching function for call to 'atoi'", even though I have #include <\cstdlib> and #include <\stdlib.h> in my file header. Unsure of where to go from here. Did some research on stackoverflow and other forums, couldn't find anything that really helped me out. Any advice? Thanks
puzzle_file >> temp
expression returns istream
, but there is no atoi
overload that would accept such a parameter.
You should call atoi(temp.c_str());