I know this doesn't pertain to much to your problem, but it greatly helps others if you add one-line comments in your code describing the intent. It also looks like you're not doing "sanity-checking" on variables. Meaning, what if the variable
doesn't initialize properly? The whole thing will "explode" so-to-say. But anyway, It looks as though each thing you are looking for is on it's own line in the document? If this is the case, you can read all the line text at once (in a sense) by using the fstream method
and if you give it the following arguments
fin.getline(pCharBuff, 128, '\n');
where "pCharBuff" is a pointer to a character buffer.
Then the function should read up to 128 characters OR until it hits the newline (\n) character.
I'll leave parsing the string up to you but that should guarantee that you get only one line from the doc.
To search for a string isn't to hard either:
// * pName is assumed to be the given name by the user.
size_t iSizeOfStr = strlen(pName); // We need the length of the input.
// Allocate new memory for the comparitor.
char *pCompName = new char;
memset(pCompName, 0, 64);
while(nullptr != pCompName) // For non-C++11 code, use NULL.
// Since we are using fstream, fStrm will be assumed as fstream fStrm.
if (!strcmp(pComName, Name))
// Parsing code goes here.
This code is obviously incomplete, but I'll leave it up to you to fill in the blanks. But what this does is it extracts the name from the file and compares it to the one given, if strcmp() returns 0, then they are the same.