2

While trying to convert my structure to byte* :

objNDSDriver.StartFn((byte*)objSTNDSFTPDriverInfo);

I am getting the error:

error C2440: 'type cast' : cannot convert from 'STNDSFTPDriverInfo' to 'byte *'

Simsons
  • 12,295
  • 42
  • 153
  • 269

2 Answers2

2

Try this

objNDSDriver.StartFn((byte*)&objSTNDSFTPDriverInfo);
DReJ
  • 1,966
  • 15
  • 14
2

You should take the address of your structure, and probably use the reinterpret_cast operator:

objNDSDriver.StartFn(reinterpret_cast<byte *>(&objSTNDSFTPDriverInfo));
Frédéric Hamidi
  • 258,201
  • 41
  • 486
  • 479
  • Thanks , Itz working now, But Why the refernce is typecasted not the obj itself? I just want to know as I am startin up with C – Simsons Dec 25 '10 at 08:58
  • @Subhen, since you want to treat `objSTNDSFTPDriverInfo` as an array of bytes, its *address* should be cast, not its value. – Frédéric Hamidi Dec 25 '10 at 09:03
  • & in this case means the address. And there is no reference in C, so you mean C++. – Nikko Dec 25 '10 at 09:43