Why is this not working when called in a function?
This does NOT work (see next code section for one that does work):
Code:
int getString(usb_device_handle* h, int index, char* buff)
{
return usb_get_string_simple( h, index, buff, sizeof( buff ) );
}
char* getValue(usb_device_handle* h, usb_device* dev)
{
char value[ 256 ];
getString( h, dev->descriptor.iManufacturer, value );
return value;
}
This DOES work:
Code:
char* getValue(usb_device_handle* h, usb_device* dev)
{
char value[ 256 ];
usb_get_string_simple( h, dev->descriptor.iManufacturer, value, sizeof( value ) );
return value;
}
For some reason, with the first one, it only grabs the first three characters of the Manufacturer string. Why?