Newbie parse data to create an array

Discussion in 'Ruby' started by mosfet, Feb 4, 2008.

  1. mosfet

    mosfet Guest

    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
    mosfet, Feb 4, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    19
    Views:
    1,105
    Daniel Vallstrom
    Mar 15, 2005
  2. Dan
    Replies:
    4
    Views:
    336
    Gregory A. Beamer
    Sep 17, 2009
  3. 7stud --

    optparse: parse v. parse! ??

    7stud --, Feb 20, 2008, in forum: Ruby
    Replies:
    3
    Views:
    175
    7stud --
    Feb 20, 2008
  4. Christiaan Venter
    Replies:
    1
    Views:
    134
    7stud --
    May 22, 2009
  5. Brk Anl
    Replies:
    4
    Views:
    151
    Robert Klemme
    Apr 7, 2010
Loading...

Share This Page