0
char* test(char* path) {
    ifstream f(string(path));
    string str(istreambuf_iterator<char>(f), istreambuf_iterator<char>());
    return str.c_str();
}

This code cannot be compiled at visual studio 2012.

Error is

error C2228: left of '.c_str' must have class/struct/union

What is the problem? Any suggestion?

plhn
  • 4,617
  • 4
  • 39
  • 46

0 Answers0