why does this code fail?
-
Hi another question why don't the following code compile? extern CFile cfile; void *data; CFile::Open(m_Pathname1,modeRead); data = cfile.Read(0,cfile.GetLength()); i get the error: error C2440: '=' : cannot convert from 'unsigned int' to 'void *' Conversion from integral type to pointer type requires einterpret_cast, C-style cast or function-style cast (BTW, what does extern do! Otherwise CFile::Read(etc) also works) thanks
-
Hi another question why don't the following code compile? extern CFile cfile; void *data; CFile::Open(m_Pathname1,modeRead); data = cfile.Read(0,cfile.GetLength()); i get the error: error C2440: '=' : cannot convert from 'unsigned int' to 'void *' Conversion from integral type to pointer type requires einterpret_cast, C-style cast or function-style cast (BTW, what does extern do! Otherwise CFile::Read(etc) also works) thanks
extern CFile cfile; CFile::Open(m_Pathname1,modeRead); DWORD dwFileLength = cfile.GetLength(); BYTE *data = new BYTE[dwFileLength]; DWORD dwBytesRed = cfile.Read(data,dwFileLength); Martin -------------------------------------------- C'mon we all know computers are experimental devices and should only be used for playing games. Using them for alternative stuff like business, is clearly not using them for what they are intended. Colin Davies
-
extern CFile cfile; CFile::Open(m_Pathname1,modeRead); DWORD dwFileLength = cfile.GetLength(); BYTE *data = new BYTE[dwFileLength]; DWORD dwBytesRed = cfile.Read(data,dwFileLength); Martin -------------------------------------------- C'mon we all know computers are experimental devices and should only be used for playing games. Using them for alternative stuff like business, is clearly not using them for what they are intended. Colin Davies
-
It allocates memory to hold data from the file. When you will finish using it, then you have to free that memory with: delete [] data; I think you have to read little bit more about C++. Martin -------------------------------------------- C'mon we all know computers are experimental devices and should only be used for playing games. Using them for alternative stuff like business, is clearly not using them for what they are intended. Colin Davies
-
It allocates memory to hold data from the file. When you will finish using it, then you have to free that memory with: delete [] data; I think you have to read little bit more about C++. Martin -------------------------------------------- C'mon we all know computers are experimental devices and should only be used for playing games. Using them for alternative stuff like business, is clearly not using them for what they are intended. Colin Davies
-
Jenny2 wrote: ok hero :):):) Martin -------------------------------------------- C'mon we all know computers are experimental devices and should only be used for playing games. Using them for alternative stuff like business, is clearly not using them for what they are intended. Colin Davies