I can see a few problems here.
1. Get rid of these lines:
Explanation: variable temp is not used anywhere in the code
2. Rename iCounter to a different name in this chunk of code:
Explanation: the same variable is used in the main loop to count the number of lines
3. In the loop above (see #2), you need to change (provided you have renamed the variable to iCounter1):
Explanation: You are accessing past the address of the sLine string.
4. Just a cosmetic change: get rid of variable i. It is not used.
Other than that, I believe the program should work. Did not test it