What i am trying to do is search each row based on a specific id and then extract the information next to it. For example, if i were to select John in the menu, the output will be like this.
John 23.21 1.24
I am not very sure how could i do this and the method to use. Could i get some guidance? To get the correct line will be easy as we just have to search for the name to get the line. But , how about the other two information? I was thinking of using the characters before it which is "32451^" and then reading the info. but how do i get it to stop at the information i want and not continue displaying the information after that which is ";gt;t"
You haven't given much to go on. I'd probably read the file, search each string for the first numeric character and use a map to map the name to that person's record. That of course, assumes each name is unique.
From there you could use strtok, or just a manual search of the characters in the record to extract the info you want. You didn't specify how to determine what you want and I have no idea where ";gt;t" came from, so I can't really give you more than that.
Sorry i think i missed out some info when i pasted my database. The info in the database is displayed like this
the information which i want retrieved would be the 23.21 and 1.24.
the problem i am having is how do i get the prog to read this two numbers and display it.
I guess the best way would be to do a search on the unique id which will be "John32451^" as the value i want is next to it. but from there, how do i get the prog to read the value till it ends with a ">"?
It depends on the format of your records. One entry is hardly enough to ascertain the format. Are the fields fixed width? Is the ">" character a delimiter of some sort? Are records separated by a CR and/or LF? Do you need numeric values for the number fields? Functions like strtok, strchr and others like atoi or atof from the standard C libraries might be effective, but we still need more info.