sblandin
sblandin

Reputation: 964

What happened to ifstream _Read_s?

I am porting a Visual Studio solution from version 2005 to version 2010.

One of the project is a native C++ project that makes use of ifstream.

The conversion process completed succsesfully, however when I try to build the native project the compiler says that "_Read_s is not a member of ifstream".

What happened to _Read_s?

There were compiler changes that make somehow the method not accesible?

This is the code that visual studio 2005 correctly builds:

ifstream binfile(pathFileToRead, ios::in | ios::binary | ios::beg);

while (!binfile.eof())
{
    binfile._Read_s(fileBuffer, CACHE_SIZE, CACHE_SIZE);

    //Do something with fileBuffer
}

Upvotes: 1

Views: 183

Answers (1)

Michael Burr
Michael Burr

Reputation: 340366

It looks like the non-standard basic_istream::_Read_s() only existed in VS 2005 and VS 2008.

You should probably just change it to use the standard basic_istream::read() function:

binfile.read(fileBuffer, CACHE_SIZE);

Upvotes: 2

Related Questions