Problem with ifstream::setbuf in VS2008
What changes are needed when porting "setbuf" in VS2005 to VS2008?
I have to modify a project in VS2005 to VS2008 to be able to build it. Below is the line of code that needs to be compiled in VS20开发者_Go百科08.
std::ifstream In;
In.setbuf(FileBuffer, BUFFER_REGION_SIZE);
When I compile the above code in VS2008, I see the below error.
error C2039: 'setbuf' : is not a member of 'std::basic_ifstream<_Elem,_Traits>'
What needs to be done to compile it in VS2008?
Did you try something like In.rdbuf()->pubsetbuf(FileBuffer, BUFFER_REGION_SIZE);
?
See http://www.cplusplus.com/reference/iostream/streambuf/pubsetbuf/
精彩评论