parse JSON from HTTP header

punee995
Posts: 4
Joined: Tue Dec 19, 2017 7:34 am

parse JSON from HTTP header

Postby punee995 » Tue Dec 19, 2017 8:30 am

i'm passing http://192.168.0.104/input.json?ssid=te ... d=12345678 from my browser and esp32 as a server receives http header..

Code: Select all

GET /input.json?ssid=test&password=12345678[/b] HTTP/1.1
Host: 192.168.0.100
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
DNT: 1
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
i know in arduino server.arg("ssid") and returns "test".

but how can i parse json from header is there any library available in ESP-IDF to extract data from HTTP header???

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: parse JSON from HTTP header

Postby kolban » Tue Dec 19, 2017 1:05 pm

What library are you using to provide an HTTP server on the ESP32? Can you elaborate on "JSON in the header" ... JSON is normally found in the payload of a HTTP POST/PUT request or in the response of an HTTP GET response.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

punee995
Posts: 4
Joined: Tue Dec 19, 2017 7:34 am

Re: parse JSON from HTTP header

Postby punee995 » Tue Dec 19, 2017 2:22 pm

i'm using lwip to create HTTP server on my esp32.

i want to save "ssid" and "password" in flash.
if i browse here [url]http://esp32_ip_address/input.json?ssid=test&password=12345678[/url] from my computer

and esp32 give me this HTTP GET Response in my serial console.

Code: Select all

GET [b]/input.json?ssid=test&password=12345678[/b] HTTP/1.1
Host: 192.168.0.100
Connection: keep-alive
Cache-Control: max-age=0
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
DNT: 1
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
how can i parse "ssid" and "password" from "GET /input.json?ssid=test&password=12345678 HTTP/1.1 is there any library available.

example in arduino:

Code: Select all

String ssidStr = server.arg("ssid");
String passStr = server.arg("password");
here is my shitty code.

Code: Select all

#include "freertos/FreeRTOS.h"
#include "esp_wifi.h"
#include "esp_system.h"
#include "esp_event.h"
#include "esp_event_loop.h"
#include "nvs_flash.h"
#include "driver/gpio.h"
#include "freertos/portmacro.h"
#include "freertos/event_groups.h"
#include "esp_log.h"
#include "tcpip_adapter.h"
static EventGroupHandle_t wifi_event_group;
const int CONNECTED_BIT = BIT0;
//static char* TAG = "app_main";

#include "lwip/err.h"
#include "string.h"

#include "cJSON.h"

#define LED_BUILTIN 16
#define delay(ms) (vTaskDelay(ms/portTICK_RATE_MS))
char* json_unformatted;

const static char http_html_hdr[] =
    "HTTP/1.1 200 OK\r\nContent-type: text/html\r\n\r\n";
const static char http_index_hml[] = "<!DOCTYPE html>"
      "<html>\n"
      "<head>\n"
      "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n"
      "  <style type=\"text/css\">\n"
      "    html, body, iframe { margin: 0; padding: 0; height: 100%; }\n"
      "    iframe { display: block; width: 100%; border: none; }\n"
      "  </style>\n"
      "<title>HELLO ESP32</title>\n"
      "</head>\n"
      "<body>\n"
      "<h1>Hello World, from ESP32!</h1>\n"
      "</body>\n"
      "</html>\n";


#include "lwip/sys.h"
#include "lwip/netdb.h"
#include "lwip/api.h"


char* http_server_get_header(char *request, char *header_name, int *len) {
  *len = 0;
  char *ret = NULL;
  char *ptr = NULL;

  ptr = strstr(request, header_name);
  if (ptr) {
    ret = ptr + strlen(header_name);
    ptr = ret;
    while (*ptr != '\0' && *ptr != '\n' && *ptr != '\r') {
      (*len)++;
      ptr++;
    }
    return ret;
  }
  return NULL;
}

static esp_err_t event_handler(void *ctx, system_event_t *event)
{
    switch(event->event_id) {
    case SYSTEM_EVENT_STA_START:
        esp_wifi_connect();
        break;
    case SYSTEM_EVENT_STA_GOT_IP:
        xEventGroupSetBits(wifi_event_group, CONNECTED_BIT);
        printf("got ip\n");
        printf("ip: " IPSTR "\n", IP2STR(&event->event_info.got_ip.ip_info.ip));
        printf("netmask: " IPSTR "\n", IP2STR(&event->event_info.got_ip.ip_info.netmask));
        printf("gw: " IPSTR "\n", IP2STR(&event->event_info.got_ip.ip_info.gw));
        printf("\n");
        fflush(stdout);
        break;
    case SYSTEM_EVENT_STA_DISCONNECTED:
        /* This is a workaround as ESP32 WiFi libs don't currently
           auto-reassociate. */
        esp_wifi_connect();
        xEventGroupClearBits(wifi_event_group, CONNECTED_BIT);
        break;
    default:
        break;
    }
    return ESP_OK;
}

static void initialise_wifi(void)
{
    tcpip_adapter_init();
    wifi_event_group = xEventGroupCreate();
    ESP_ERROR_CHECK( esp_event_loop_init(event_handler, NULL) );
    wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
    ESP_ERROR_CHECK( esp_wifi_init(&cfg) );
    ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) );
    ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
    wifi_config_t sta_config = {
        .sta = {
            .ssid = "test",
            .password = "1234test",
            .bssid_set = false
        }
    };

    ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &sta_config) );
    ESP_ERROR_CHECK( esp_wifi_start() );
}

static void
http_server_netconn_serve(struct netconn *conn)
{
  struct netbuf *inbuf;
  char *buf;
  u16_t buflen;
  err_t err;

  /* Read the data from the port, blocking if nothing yet there.
   We assume the request (the part we care about) is in one netbuf */
  err = netconn_recv(conn, &inbuf);

  if (err == ERR_OK) {
    netbuf_data(inbuf, (void**)&buf, &buflen);
    char *save_ptr = buf;
    // strncpy(_mBuffer, buf, buflen);

    /* Is this an HTTP GET command? (only check the first 5 chars, since
    there are other formats for GET, and we're keeping it very simple )*/
    //printf("buffer = %s \n", buf);
    if (buflen>=5 &&
        buf[0]=='G' &&
        buf[1]=='E' &&
        buf[2]=='T' &&
        buf[3]==' ' &&
        buf[4]=='/' ) {
    //      printf("buf[5] = %c\n", buf[5]);
      /* Send the HTML header
             * subtract 1 from the size, since we dont send the \0 in the string
             * NETCONN_NOCOPY: our data is const static, so no need to copy it
       */

      netconn_write(conn, http_html_hdr, sizeof(http_html_hdr)-1, NETCONN_NOCOPY);

      if(buf[5]=='h') {
        gpio_set_level(LED_BUILTIN, 0);
        /* Send our HTML page */
        netconn_write(conn, http_index_hml, sizeof(http_index_hml)-1, NETCONN_NOCOPY);
      }
      else if(buf[5]=='l') {
        gpio_set_level(LED_BUILTIN, 1);
        /* Send our HTML page */
        netconn_write(conn, http_index_hml, sizeof(http_index_hml)-1, NETCONN_NOCOPY);
      }
      
      else if(strstr(buf, "GET /input.json")) {
        netconn_write(conn, json_unformatted, strlen(json_unformatted), NETCONN_NOCOPY);
        

        const char ent[2] = "\n";
        const char spa[2] = " ";
        const char que[2] = "?";
        const char equ[2] = "=";
        const char end[2] = "&";

        int i = 0;
        int j = 0;
        int k = 0;
        int l = 0;
        int m = 0;


        char *token[40];
        token[i] = strtok(buf, ent);
        while( token[i] != NULL ) {
 //         printf("%s\n",token[i] );
            i++;
            token[i] = strtok(NULL, ent);
        }
        char *token1[40];
        token1[j] = strtok(token[0],spa);
        while(token1[j] != NULL ){
 //         printf("%s\n",token1[j] );
            j++;
            token1[j] = strtok(NULL,spa);
        }
        char *token2[40];
        token2[k] = strtok(token1[1],que);
        while(token2[k] != NULL ){
//          printf("%s\n",token2[k] );
            k++;
            token2[k] = strtok(NULL,que);
        }
        char *token3[40];
        token3[l] = strtok(token2[1],end);
        while(token3[l] != NULL ){
        //printf("%s\n", token3[l]);
            l++;              // total argument in Header
            token3[l] = strtok(NULL,end);
        }
        char *token4[40];
        token4[m] = strtok(token3[1],equ);
        while(token4[m] != NULL ){
         printf("%s\n", token4[m]);
            l++;              // total argument in Header
            token4[m] = strtok(NULL,equ);
        }

        /// Not Working////

        // char *token4[40];     
        // char *value[40];
        // char *key[40];
        // int p = 0;
        // int q = 0;
        // for (i = 0; i < l; i++){
        //     token4[m] = strtok(token3[i],equ);
        //     while(token4[m] != NULL ){
        //         if (m%2){
        //             printf("value :%s\n", token4[m]);
        //             value[p] = token4[m];
        //             p++;
        //             m++;              
        //             token4[m] = strtok(NULL,equ);       
        //         }
        //         else{
        //             printf("key :%s\n", token4[m]);
        //             key[q] = token4[m];
        //             q++;
        //             m++;              
        //             token4[m] = strtok(NULL,equ);
        //         }
        //     }
        // }        
      }

      else {
          netconn_write(conn, http_index_hml, sizeof(http_index_hml)-1, NETCONN_NOCOPY);
      }
    }

  }
  /* Close the connection (server closes in HTTP) */
  netconn_close(conn);

  /* Delete the buffer (netconn_recv gives us ownership,
   so we have to make sure to deallocate the buffer) */
  netbuf_delete(inbuf);
}

static void http_server(void *pvParameters)
{
  struct netconn *conn, *newconn;
  err_t err;
  conn = netconn_new(NETCONN_TCP);
  netconn_bind(conn, NULL, 80);
  netconn_listen(conn);
  do {
     err = netconn_accept(conn, &newconn);
     if (err == ERR_OK) {
       http_server_netconn_serve(newconn);
       netconn_delete(newconn);
     }
   } while(err == ERR_OK);
   netconn_close(conn);
   netconn_delete(conn);
}


static void generate_json() {
  cJSON *root, *info, *d;
  root = cJSON_CreateObject();

  cJSON_AddItemToObject(root, "d", d = cJSON_CreateObject());
  cJSON_AddItemToObject(root, "info", info = cJSON_CreateObject());

  cJSON_AddStringToObject(d, "myName", "CMMC-ESP32-NANO");
  cJSON_AddNumberToObject(d, "temperature", 30.100);
  cJSON_AddNumberToObject(d, "humidity", 70.123);

  cJSON_AddStringToObject(info, "ssid", "dummy");
  cJSON_AddNumberToObject(info, "heap", system_get_free_heap_size());
  cJSON_AddStringToObject(info, "sdk", system_get_sdk_version());
  cJSON_AddNumberToObject(info, "time", system_get_time());

  while (1) {
    cJSON_ReplaceItemInObject(info, "heap",
        cJSON_CreateNumber(system_get_free_heap_size()));
    cJSON_ReplaceItemInObject(info, "time",
        cJSON_CreateNumber(system_get_time()));
    cJSON_ReplaceItemInObject(info, "sdk",
        cJSON_CreateString(system_get_sdk_version()));

    json_unformatted = cJSON_PrintUnformatted(root);
    //printf("[len = %d]  ", strlen(json_unformatted));

    // for (int var = 0; var < strlen(json_unformatted); ++var) {
    //   putc(json_unformatted[var], stdout);
    // }

    printf("\n");
    fflush(stdout);
    delay(2000);
    free(json_unformatted);
  }
}

int app_main(void)
{
    nvs_flash_init();
    system_init();
    initialise_wifi();

    gpio_pad_select_gpio(LED_BUILTIN);

    /* Set the GPIO as a push/pull output */
    gpio_set_direction(LED_BUILTIN, GPIO_MODE_OUTPUT);
    xTaskCreate(&generate_json, "json", 2048, NULL, 5, NULL);
    xTaskCreate(&http_server, "http_server", 2048, NULL, 5, NULL);
    return 0;
}

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: parse JSON from HTTP header

Postby Ritesh » Wed Dec 20, 2017 6:21 pm

Hi,

There is nghttpd component which is provided as submodule into ESP32 IDF SDK. So, you can use it as HTTP server and also you can use cJSON library which is also provided as component into ESP32 IDF SDK.

So Both components are available into older and latest ESP32 IDF.

Let me know.if you need any help for that as we are validating REST interface for our project Requirement.
Regards,
Ritesh Prajapati

punee995
Posts: 4
Joined: Tue Dec 19, 2017 7:34 am

Re: parse JSON from HTTP header

Postby punee995 » Thu Dec 21, 2017 5:44 am

Ritesh wrote:Hi,

There is nghttpd component which is provided as submodule into ESP32 IDF SDK. So, you can use it as HTTP server and also you can use cJSON library which is also provided as component into ESP32 IDF SDK.

So Both components are available into older and latest ESP32 IDF.

Let me know.if you need any help for that as we are validating REST interface for our project Requirement.

Did not find any Example related to "nghttpd" or "http-parser" can you provide one please????

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: parse JSON from HTTP header

Postby Ritesh » Thu Dec 21, 2017 5:34 pm

punee995 wrote:
Ritesh wrote:Hi,

There is nghttpd component which is provided as submodule into ESP32 IDF SDK. So, you can use it as HTTP server and also you can use cJSON library which is also provided as component into ESP32 IDF SDK.

So Both components are available into older and latest ESP32 IDF.

Let me know.if you need any help for that as we are validating REST interface for our project Requirement.

Did not find any Example related to "nghttpd" or "http-parser" can you provide one please????
Please find sample example link for http web server.

https://github.com/cmmakerclub/esp32-webserver

Let me know if any doubt or query for that as we have already validated that example and making our own application by taking that example as reference
Regards,
Ritesh Prajapati

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: parse JSON from HTTP header

Postby Ritesh » Sat Dec 23, 2017 9:32 am

Ritesh wrote:
punee995 wrote:
Ritesh wrote:Hi,

There is nghttpd component which is provided as submodule into ESP32 IDF SDK. So, you can use it as HTTP server and also you can use cJSON library which is also provided as component into ESP32 IDF SDK.

So Both components are available into older and latest ESP32 IDF.

Let me know.if you need any help for that as we are validating REST interface for our project Requirement.

Did not find any Example related to "nghttpd" or "http-parser" can you provide one please????
Please find sample example link for http web server.

https://github.com/cmmakerclub/esp32-webserver

Let me know if any doubt or query for that as we have already validated that example and making our own application by taking that example as reference
Above Link is useful for your query or not?
Regards,
Ritesh Prajapati

punee995
Posts: 4
Joined: Tue Dec 19, 2017 7:34 am

Re: parse JSON from HTTP header

Postby punee995 » Sat Dec 23, 2017 4:31 pm

http server runs without a problem but i need to extract data from POST Header did not found way to do that

here is my post request and i want "uname" and "name":

Code: Select all

POST /connect.json HTTP/1.1
Host: 192.168.4.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.4.1/
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 68
Connection: keep-alive

udata=%7B%22name%22%3A%22punit%22%2C%22password%22%3A%22123456%22%7D&name=punit

I need example to do that and don't want to use my functions,

Here is my functions to do that(not reliable).

Code: Select all

 ////////////////////   URL Decoder   /////////////////////////////

char from_hex(int ch) {
  return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
}

char *url_decode(char *str) {
  char *pstr = str, *buf = malloc(strlen(str) + 1), *pbuf = buf;
  while (*pstr) {
    if (*pstr == '%') {
      if (pstr[1] && pstr[2]) {
        *pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]);
        pstr += 2;
      }
    } else if (*pstr == '+') { 
      *pbuf++ = ' ';
    } else {
      *pbuf++ = *pstr;
    }
    pstr++;
  }
  *pbuf = '\0';
  return buf;
}

///////////////////////////  Request Handler  //////////////////////////////

char* http_server_get_header(char *request, char *header_name, int *len) {
  *len = 0;
  char *ret = NULL;
  char *ptr = NULL;

  ptr = strstr(request, header_name);
  if (ptr) {
    ret = ptr + strlen(header_name);
    ptr = ret;
    //printf("ret_1 : %s\n\n\n", ret);
    while (*ptr != '&' && *ptr != '\0' && *ptr != '\n' && *ptr != '\r') {
      (*len)++;

      ptr++;
    }
    return ret;
  }
  return NULL;
}

Ritesh
Posts: 1383
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: parse JSON from HTTP header

Postby Ritesh » Wed Dec 27, 2017 5:22 pm

punee995 wrote:http server runs without a problem but i need to extract data from POST Header did not found way to do that

here is my post request and i want "uname" and "name":

Code: Select all

POST /connect.json HTTP/1.1
Host: 192.168.4.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.4.1/
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 68
Connection: keep-alive

udata=%7B%22name%22%3A%22punit%22%2C%22password%22%3A%22123456%22%7D&name=punit

I need example to do that and don't want to use my functions,

Here is my functions to do that(not reliable).

Code: Select all

 ////////////////////   URL Decoder   /////////////////////////////

char from_hex(int ch) {
  return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
}

char *url_decode(char *str) {
  char *pstr = str, *buf = malloc(strlen(str) + 1), *pbuf = buf;
  while (*pstr) {
    if (*pstr == '%') {
      if (pstr[1] && pstr[2]) {
        *pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]);
        pstr += 2;
      }
    } else if (*pstr == '+') { 
      *pbuf++ = ' ';
    } else {
      *pbuf++ = *pstr;
    }
    pstr++;
  }
  *pbuf = '\0';
  return buf;
}

///////////////////////////  Request Handler  //////////////////////////////

char* http_server_get_header(char *request, char *header_name, int *len) {
  *len = 0;
  char *ret = NULL;
  char *ptr = NULL;

  ptr = strstr(request, header_name);
  if (ptr) {
    ret = ptr + strlen(header_name);
    ptr = ret;
    //printf("ret_1 : %s\n\n\n", ret);
    while (*ptr != '&' && *ptr != '\0' && *ptr != '\n' && *ptr != '\r') {
      (*len)++;

      ptr++;
    }
    return ret;
  }
  return NULL;
}
Hi,

Once you get header and body then you need to implement parser to get data based on payload you received.

So, That needs to implement by your own way as Web Server will not provide that type of logic or code. It will just provide sample code or dummy parser code for that.
Regards,
Ritesh Prajapati

burkulesomesh43
Posts: 132
Joined: Tue Aug 14, 2018 6:21 am
Location: India

Re: parse JSON from HTTP header

Postby burkulesomesh43 » Tue Dec 18, 2018 11:53 am

punee995 wrote:
Sat Dec 23, 2017 4:31 pm
http server runs without a problem but i need to extract data from POST Header did not found way to do that

here is my post request and i want "uname" and "name":

Code: Select all

POST /connect.json HTTP/1.1
Host: 192.168.4.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:57.0) Gecko/20100101 Firefox/57.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: http://192.168.4.1/
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 68
Connection: keep-alive

udata=%7B%22name%22%3A%22punit%22%2C%22password%22%3A%22123456%22%7D&name=punit

I need example to do that and don't want to use my functions,

Here is my functions to do that(not reliable).

Code: Select all

 ////////////////////   URL Decoder   /////////////////////////////

char from_hex(int ch) {
  return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
}

char *url_decode(char *str) {
  char *pstr = str, *buf = malloc(strlen(str) + 1), *pbuf = buf;
  while (*pstr) {
    if (*pstr == '%') {
      if (pstr[1] && pstr[2]) {
        *pbuf++ = from_hex(pstr[1]) << 4 | from_hex(pstr[2]);
        pstr += 2;
      }
    } else if (*pstr == '+') { 
      *pbuf++ = ' ';
    } else {
      *pbuf++ = *pstr;
    }
    pstr++;
  }
  *pbuf = '\0';
  return buf;
}

///////////////////////////  Request Handler  //////////////////////////////

char* http_server_get_header(char *request, char *header_name, int *len) {
  *len = 0;
  char *ret = NULL;
  char *ptr = NULL;

  ptr = strstr(request, header_name);
  if (ptr) {
    ret = ptr + strlen(header_name);
    ptr = ret;
    //printf("ret_1 : %s\n\n\n", ret);
    while (*ptr != '&' && *ptr != '\0' && *ptr != '\n' && *ptr != '\r') {
      (*len)++;

      ptr++;
    }
    return ret;
  }
  return NULL;
}

Code: Select all

char *urlDecode(const char *str) {

  char *dStr = (char *) malloc(strlen(str) + 1);
  char eStr[] = "00"; /* for a hex code */

  strcpy(dStr, str);
    int i; /* the counter for the string */

    for(i=0;i<strlen(dStr);++i) {

      if(dStr[i] == '%') {
        if(dStr[i+1] == 0)
          return dStr;

        if(isxdigit((int)dStr[i+1]) && isxdigit((int)dStr[i+2])) {

          /* combine the next to numbers into one */
          eStr[0] = dStr[i+1];
          eStr[1] = dStr[i+2];

          /* convert it to decimal */
          long int x = strtol(eStr, NULL, 16);

          /* remove the hex */
          memmove(&dStr[i+1], &dStr[i+3], strlen(&dStr[i+3])+1);

          dStr[i] = x;
        }
      }
      else if(dStr[i] == '+') { dStr[i] = ' '; }
    }
  return dStr;
}
use this one. it may helpful
--
Somesh Burkule

Who is online

Users browsing this forum: MicroController and 69 guests