Comment convertir un uint8_t* en const char
Bonjour à tous,
J'exécute un code que j'ai repris. Voci la partie qui me cause problème et tout particulièrement avec
Code:
display.print(buf);
J'ai un problème de convertion et je ne sais pas comment convertir ceci
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
uint8_t len = sizeof(buf);
uint8_t from = rf95.headerFrom();
uint8_t to = rf95.headerTo();
uint8_t id = rf95.headerId();
uint8_t flags= rf95.headerFlags();;
int8_t rssi = rf95.lastRssi();
if (rf95.recv(buf, &len)) {
printf("Packet[%02d] #%d => #%d %ddB: ", len, from, to, rssi);
printbuffer(buf, len);
/* OLED */
display.print("Packet[");
//display.print(len);
display.print("] ");
display.print("#");
//display.print(from);
display.print("=>");
//display.print(to);
display.print(" ");
display.print("rssi:");
//display.print(rssi);
display.print("\n");
display.print(buf);
display.print("\n");
display.display();
} else {
Serial.print("receive failed");
/* OLED */
display.print("received failed\n");
display.display();
} |
Pourtant j'ai essayé ceci
Citation:
display.print((char*)buf);
display.print((char*)to);
etc..
sans succès...
Voici le message que je reçois pour le buf
Citation:
rf95_server.cpp:249:18: error: invalid conversion from ‘uint8_t* {aka unsigned char*}’ to ‘const char*’ [-fpermissive]
display.print(buf);
Comment convertir ceci?
Merci pour vos lumières!