Such an error gets out:
Debug Assertion Failed!
Program: ... 321 \ Documents \ Visual Studio 2010 \ Projects \ core \ Debug \ core.exe
File: c: \ program files (x86) \ microsoft visual studio 10.0 \ vc \ include \ xstring
Line: 930Expression: invalid null pointer
For information on how you can see the faiilure, see the Visual C ++ documentation on asserts.
(Press Retry to debug the application)
I am very confused: the same code works differently in 2 programs (one is fine, the other is an error). What to do?
in.open(flname); string lines; { std::string buff; while(!in.eof()) { getline(in, buff); lines += buff + '\n'; } in.close(); std::cout << "reading the " << name << " file was successfully" << std::endl; std::cout <<"-----------------------------------------" << std::endl; strcpy(mass, lines.c_str()); std::cout << mass << std::endl; ;
If you comment getline
, then everything is fine. What needs to be done to make it work?