# Newbie parse data to create an array

**URL:** <https://www.ruby-forum.com/t/newbie-parse-data-to-create-an-array/128032>\
**Category:** Ruby\
**Created:** [February 4, 2008, 1:45pm UTC](https://www.ruby-forum.com/t/newbie-parse-data-to-create-an-array/128032 "2008-02-04T13:45:32Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mosfet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/3ab097/32.png) [@mosfet](https://www.ruby-forum.com/u/mosfet)\
**Post date:** [February 4, 2008, 1:45pm UTC](https://www.ruby-forum.com/t/newbie-parse-data-to-create-an-array/128032/1 "2008-02-04T13:45:32Z")

</div>

Hi,

I would like to discover ruby and to do so I would like to do the  
following thing :

I have a text file with some COM defines declared like this :

#define PR\_ORIGINAL\_ENTRYID PROP\_TAG( PT\_BINARY,  
0x3A12)  
#define PR\_ORIGINAL\_DISPLAY\_NAME PROP\_TAG(  
PT\_TSTRING, 0x3A13)

And I would like to open this file and create a C array with these  
properties

typedef struct mapiProp\_s  
{  
ULONG ulPropId;  
ULONG ulPropType;  
}mapiProp\_t;

mapiProp\_t mapiPropArray[] =  
{  
{ PR\_ORIGINAL\_ENTRYID, “PR\_ORIGINAL\_ENTRYID”, PT\_BINARY },  
{ PR\_ORIGINAL\_DISPLAY\_NAME, “PR\_ORIGINAL\_DISPLAY\_NAME”, PT\_TSTRING },  
};

So basically I need to open a file, check if it starts by #define PR\_  
and then extract data.  
If someone could help me to start…

Thanks
