How to parse text file

What is best way to parse this text file ?
I would like to read the contents of the C code array.

#define index_html_gz_len 12
const uint8_t index_html_gz[] PROGMEM = {
0x1f,0x8b,0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xec,0xbd,0x8b};

Hi,
The title says “text file” but here I see a binary array.
Do I miss something?

This is text file, C code listing.
I want to pass this file as argument to my program in GO and read the contents of the C array to byte array in golang.

I’d say the *best* way to do this would be to find a C parser and parse what you’re looking for. That, however, might be overkill for what you need.

Given just the requirement to parse the content of this C array, I would just use some regular expressions to “parse” the data that you’re looking for: https://play.golang.org/p/r1xCun4NuC2

1 Like

Thank you very much, that’s exactly what I need. :smiley:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.