jeudi 3 septembre 2015

Migration from C++ Visual 2006 to V2010 CFile to ifstream

I would like to migrate some piece of code written in C++ Visual 2006 do C++ V2010. It was:

CFile *fInp;
...
int iStatus = fInp->Read(chMsg, iMaxBuffer);

and now I am trying to do this like:

ifstream *fInp;
...
int iStatus = fInp->read(chMsg, iMaxBuffer);

but CFile::Read returns int with value of how many characters has been moved, but ifstream::read doesn't. How can I get that value?

Will this work:

fInp->read(chMsg, iMaxBuffer);
int iStatus = fInp->gcount();

??

Aucun commentaire:

Enregistrer un commentaire