Invalid conversion from 'const unsigned char*' to 'const char*' when converting ble code

I am getting this error:

invalid conversion from 'const unsigned char*' to 'const char*' [-fpermissive]

When I am trying to convert this code:

  uint8_t* file_block_buffer = in_progress_file_buffer + in_progress_bytes_received;
  characteristic.readValue(file_block_buffer, file_block_length);

to this code:

  uint8_t* file_block_buffer = in_progress_file_buffer + in_progress_bytes_received;
  strncat(file_block_buffer, characteristic.value(), file_block_length);

As I am porting to BLEPeripheral.h from ArduinoBLE.h.

The code is from petewarden/ble_file_transfer: Example of transferring file data over BLE using an Arduino Nano Sense and WebBLE (github.com)

Your topic was MOVED to its current forum category which is more appropriate than the original as it has nothing to do with Installation and Troubleshooting of the IDE

strncat expects a char*, not an unsigned char*. You probably want to use memcpy instead.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.