S
seia0106
Hello
I am writing a function to read a binary file. Here is a part of code
#include <fstream>
..
..
BYTE *pData;
long lDataLen;
pms->GetPointer(&pData);
lDataLen = pms->GetSize();
// Read one line at a time till end of file..
if (m_inFile.getline(pData,
lDataLen))pms->SetActualDataLength(strlen((char*)pData)+1);
else {return S_FALSE;}
...................
The error message that i get is this
error C2664: 'class std::basic_istream<char,struct
std::char_traits<char> > &__thiscall std::basic_istream<char,struct
std::char_traits<char> >::getline(char *,int)'
: cannot convert parameter 1 from 'unsigned char *' to 'char *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
Conflict in datatypes is causing this error. How can i solve this
problem? Which type of casting is better here and how it should be
used here.
thanks
I am writing a function to read a binary file. Here is a part of code
#include <fstream>
..
..
BYTE *pData;
long lDataLen;
pms->GetPointer(&pData);
lDataLen = pms->GetSize();
// Read one line at a time till end of file..
if (m_inFile.getline(pData,
lDataLen))pms->SetActualDataLength(strlen((char*)pData)+1);
else {return S_FALSE;}
...................
The error message that i get is this
error C2664: 'class std::basic_istream<char,struct
std::char_traits<char> > &__thiscall std::basic_istream<char,struct
std::char_traits<char> >::getline(char *,int)'
: cannot convert parameter 1 from 'unsigned char *' to 'char *'
Types pointed to are unrelated; conversion requires
reinterpret_cast, C-style cast or function-style cast
Conflict in datatypes is causing this error. How can i solve this
problem? Which type of casting is better here and how it should be
used here.
thanks