This is WIZnet Ethernet Interface using Hardware TCP/IP chip, W5500, W5200 and W5100. One of them can be selected by enabling it in wiznet.h.

Dependents:   Embedded_web EmailButton EmailButton HTTPClient_Weather ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers pico_string.h Source File

pico_string.h

00001 // pico_string.h 2013/8/27
00002 #pragma once
00003 class pico_string {
00004 public:
00005     pico_string(){
00006         _len = 0;
00007         _buf = (char*)malloc(1);
00008         if (_buf) {
00009             _buf[0] = '\0';
00010         }
00011     }
00012     ~pico_string() {
00013         if (_buf) {
00014             free(_buf);
00015         }
00016     }
00017     bool empty() {
00018         return _len == 0;
00019     }
00020     void append(const char* s, int len) {
00021         if (_buf == NULL) {
00022             return;
00023         }
00024         char* p = (char*)malloc(_len+len+1);
00025         if (p == NULL) {
00026             return;
00027         }
00028         memcpy(p, _buf, _len);
00029         memcpy(p+_len, s, len);
00030         p[_len+len] = '\0';
00031         free(_buf);
00032         _buf = p;
00033     }
00034     void append(const char* s) {
00035         append(s, strlen(s));
00036     }
00037     char* c_str() {
00038         if (_buf) {
00039             return _buf;
00040         }
00041         return "";
00042     }
00043 private:
00044     char* _buf;
00045     int _len;
00046 };