<p>I have the following file/line:</p>

<pre><code>pc=1 ct=1 av=112 cv=1100 cp=1700 rec=2 p=10001 g=0 a=0 sz=5 cr=200
pc=1 ct=1 av=113 cv=1110 cp=1800 rec=2 p=10001 g=0 a=10 sz=5 cr=200
</code></pre>

<p>and so on. 
I wish to parse this and take the key value pairs and put them in a structure:</p>

<pre><code>struct pky
{
    pky() :
      a_id(0),
      sz_id(0),
      cr_id(0),
      cp_id(0),
      cv_id(0),
      ct_id(0),
      fr(0),
      g('U'),
      a(0),
      pc(0),
      p_id(0)
    { }
};
</code></pre>

<p>wherein either all the structure fields are used or some might be omitted.</p>

<p>How do I create a C++ class, which will do the same? I am new to C++ and not aware of any functions or library which would do this work.</p>

<p>Each line is to be processed, and the structure will be populated with one line each time and used, before it is flushed. The structure is later used as a parameter to a function.</p>

Unfortunately, your source data file is human-oriented, which means that you're going to have to do a bunch of string parsing in order to get it into the structure.  Otherwise, if the data had been written directly as a binary file, you could just use fread() to pop it directly into the struct.
If you want to use an "elegant" (ie, ugly minimalistic approach), you could make a loop of sorts to parse each line, basically using strchr() to first find the '=' character, then the next space, then using atoi() to convert each number into a real int, and then using some pointer hackery to push them all into the structure.  The obvious disadvantage there is that if the structure changes, or is even reorganized somehow, then the whole algorithm here would silently break.
So, for something that would be more maintainable and readable (but result in more code), you could just push each value into a vector, and then go through the vector and copy each value into the appropriate strucutre field.