Hello, i am using the example enet_lwip for show a integer variable in the web page. The problem is this is wrong showed. For example, the value in the variable is 50 and the value shown in the web page is 0ERR. In the .c file. When the client do a GET, call the function and this response sending this:
Request:
function getvoltage() {
var vol = false;
function VoltageComplete() {
if(vol.readyState == 4) {
if(vol.status == 200) {
document.getElementById("voltage").innerHTML = "<div>" + vol.responseText + "</div>";
}
}
}
if(window.XMLHttpRequest) {
vol = new XMLHttpRequest();
}
else if(window.ActiveXObject)
{
vol = new ActiveXObject("Microsoft.XMLHTTP");
}
if(vol)
{
vol.open("GET", "/cgi-bin/get_voltage?id" + Math.random(), true);
vol.onreadystatechange = VoltageComplete;
vol.send(null);
}
}
Response:
if(ustrncmp(pcName, "/cgi-bin/get_voltage", 19) == 0)
{
static char pcBuf[5];
usnprintf(pcBuf,5, "%d%",decena);
psFile->data = pcBuf;
psFile->len = strlen(pcBuf);
psFile->index = psFile->len;
psFile->pextension = NULL;
//
// Return the psFile system pointer.
//
return(psFile);
}
decena is the name of the variable showed in the web page.
I think the problem is in usnprintf... but i dont know what is the correct form
Regards
Matias