I have been in your situation. It is nasty. However, I am not the first person to be in that situation and you will not be the last. I understand so I'll provide you an answer.

Clear the decks. Until after finals, you will do three things and three things only: 1) Study and do homework 2) Eat when necessary 3) Sleep as little as possible.

Welcome to the club.

abdallah mohamad commented: So would you want to help me?? +0

It seems to me you need to scan the input file, line-by-line, looking for (name, value) pairs. The file is very regular. To find the value for any named item, I'd just use Regular Expressions to scan for something that looks like: "value=", e.g. "cookie=" or "duration=". From the character just after the "=", just extract everything up to next comma or end-of-line and that is the corresponding value. The Regular Expression can hand you the item name without the equals-sign and the value without the trailing comma.

Regular Expressions (RegEx's) are explicitly designed to scan a string and pick out patterns in the string. The patterns can be quite complex; I've seen a RegEx that can verify if an email address is syntactically correct according to the formal standard. Your situation is a very simple one.

They are both, when you come down to it, the same not very good way to do this. The counter does not have to be a global (or a pointer) and it shouldn't be a global (or a pointer) because there are too many ways for the value to get stepped on. What I would do is to make the counter a class, a simple class, that has at least three methods: increment, read value, and reset. The counter itself would be an instance variable of the class. You also might want to think about concurrency, that is, what if two threads call the class at the same time? Check into semaphores. It might not be a problem you have to worry about but I think it is a problem you have to at least think about.

Using a class also gives you a chance to find out who is diddling with the counter. You can set a breakpoint in the class and then look at the call stack.