Buffer : array[0..10] of Byte


2006-08-15 03:59:31 PM
cppbuilder61
I want to make a I2C application in cbuilder 5. For this application I
using a Delphi program and the dll file witch I have downloaded by
www.elektuur.nl. Its free to download. Now I want to convert this
program to Cbuilder 5. After many error's I reduce this to a error that
like to say something goes wrong with this :
if (I2C_USB_Read(PCF8574_ADR+1,1,Buffer))
gives errors
[C++ Error] usb_rivor.cpp(89): E2034 Cannot convert 'unsigned char *'
to 'unsigned char'
[C++ Error] usb_rivor.cpp(89): E2342 Type mismatch in parameter
'vardata' (wanted 'unsigned char', got 'unsigned char *')
[C++ Error] usb_rivor.cpp(89): E2034 Cannot convert 'void' to 'bool'
This is the ELEKTOR_I2C_USB.dll in Delphi:
.....
......
function I2C_USB_Read(adr : Byte; lenght : Byte; var data : array of
Byte):Boolean;stdcall;external 'ELEKTOR_I2C_USB.DLL' ;
.....
....
implementation
const PCF8574_ADR=64
var
Buffer : array [0..10] Byte
For Builder I have this in .cpp:
const PCF8574_ADR = 64;
unsigned char Buffer[10];
extern "C" void __declspec(dllexport) I2C_USB_Read(unsigned char
adr,unsigned char lenght, unsigned char vardata );
in .h file
typedef void __declspec(dllimport) I2C_USB_ReadType (unsigned char
adr,unsigned char lenght, unsigned char vardata ) ;
I2C_USB_ReadType *LoadI2C_USB_ReadFunction;
Something goes wrong with buffer.
Who can help me.