Lakshmi
Lakshmi

Reputation: 179

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 VS2008.

 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?

Upvotes: 0

Views: 409

Answers (1)

Mark B
Mark B

Reputation: 96281

Did you try something like In.rdbuf()->pubsetbuf(FileBuffer, BUFFER_REGION_SIZE);?

See http://www.cplusplus.com/reference/iostream/streambuf/pubsetbuf/

Upvotes: 1

Related Questions