I'm new to C and Arduino development and wondering what's going on here. The code is supposed to print the response from an HTTP request, but instead it cuts off after around 300 bytes.
static void my_callback (byte status, word off, word len) {
Ethernet::buffer[off+300] = 0; // <--
Serial.print((const char*) Ethernet::buffer + off); // <--
}
In Javascript, Ethernet::buffer[off+300] = 0
would mean you're assigning a value of 0
to something in an object or array, at position [off+300]
. Why is this being done here before the result is returned, or at all?
Next, the value of Ethernet::buffer
is added to the value of off
(which is a number). So the result should be a number, but instead it's a string.
Any insight into what is going on here would be really appreciated. Thanks.
Source: EtherCard examples