-->
Page 2 of 3

Re: readFile function with ESP32

PostPosted: Thu Mar 14, 2019 3:25 pm
by RichardS
Try


Code: Select allchar buf[32];
int len;
 while  (len = webFile.read((uint8_t *)buf, 32)) {
   client.write((const char*)buf, len);
 }


Sirquil wrote:
Try making char buf[1024] into char buf[32]

The serial printing may not like the long print....

RichardS


Still drops characters with char buf[32].

Code: Select allchar buf[32];
int len;
 while  (len = webFile.read(buf, 32)) {
   client.write((const char*)buf, len);
 }


Produces compiler error: invalid conversion from 'char*' to 'uint8_t* {aka unsigned char*}' [-fpermissive]

Thank you for the suggestions.

William

Re: readFile function with ESP32

PostPosted: Thu Mar 14, 2019 3:39 pm
by RichardS
If that does not work... add.... serial.print to see if its happening there also.... if not you know its something 100% client.write related.

char buf[32];
int len;
while (len = webFile.read((uint8_t *)buf, 32)) {
client.write((const char*)buf, len);
Serial.print((const char*)buf, len);
}

RichardS

Re: readFile function with ESP32

PostPosted: Thu Mar 14, 2019 3:43 pm
by Sirquil
Perfect! Thank you RichardS.

Your code works with char buf[1024], perfectly!

William

Re: readFile function with ESP32

PostPosted: Thu Mar 14, 2019 4:00 pm
by RichardS
Awsome! :lol:

RichardS