user56049: I'm trying to display a bitmap on gLCD 128x64, I stored the bitmap into txt file 1.txt in a SD card this is a part of bit map  as following:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
0xC0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00.......
I want to convert the content of this text into array:
Unsigned char logo[] with making a split on ",".
Any help please

user4143: The most efficient way is to read the file byte-by-byte into a small character array until you get a comma or the end of file - ignoring any characters that aren't of interest (line feeds, etc).
Then for each chunk that you read you then convert it to an integer.
For example (untested):
char temp[5] = {0}; // should be more than enough
int pos = 0;
int bno = 0;

const char *hexchars = "0123456789abcdefABCDEFx";

while ((int ch = myFile.read()) >= 0) {
    if (ch == ',') { // We found a comma
        logo[bno++] = strtoul(temp, NULL, 16); // Base 16 conversion
        pos = 0;
        temp[0] = 0;
    } else if (strchr(hexchars, ch) != NULL) {
        if (pos < 4) {
            temp[pos++] = ch;
            temp[pos] = 0;
        }
    }
}

Of course, you have to know how big the logo array has to be beforehand.
One does, though, have to ask "Why are you storing a graphical logo as a textual representation of binary data" in the first place?  It would be far easier to just store it as a simple binary file and read the data directly into the logo array with a single File::read(void *buf, size_t nbyte); function call.  Using text as an intermediate format is both wasteful and needlessly increases complexity massively.

56049: <p>I'm trying to display a bitmap on gLCD 128x64, I stored the bitmap into txt file <code>1.txt</code> in a SD card this is a part of bit map  as following:</p>

<p>0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
0xC0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00.......</p>

<p>I want to convert the content of this text into array:
<code>Unsigned char logo[]</code> with making a split on "<code>,</code>".</p>

<p>Any help please</p>
 4143: <p>The most efficient way is to read the file byte-by-byte into a small character array until you get a comma or the end of file - ignoring any characters that aren't of interest (line feeds, etc).</p>

<p>Then for each chunk that you read you then convert it to an integer.</p>

<p>For example (untested):</p>

<pre><code>char temp[5] = {0}; // should be more than enough
int pos = 0;
int bno = 0;

const char *hexchars = "0123456789abcdefABCDEFx";

while ((int ch = myFile.read()) &gt;= 0) {
    if (ch == ',') { // We found a comma
        logo[bno++] = strtoul(temp, NULL, 16); // Base 16 conversion
        pos = 0;
        temp[0] = 0;
    } else if (strchr(hexchars, ch) != NULL) {
        if (pos &lt; 4) {
            temp[pos++] = ch;
            temp[pos] = 0;
        }
    }
}
</code></pre>

<p>Of course, you have to know how big the <code>logo</code> array has to be beforehand.</p>

<p>One does, though, have to ask "Why are you storing a graphical logo as a textual representation of binary data" in the first place?  It would be far easier to just store it as a simple binary file and read the data directly into the <code>logo</code> array with a single <code>File::read(void *buf, size_t nbyte);</code> function call.  Using text as an intermediate format is both wasteful and needlessly increases complexity massively.</p>
