first your loop is wrong. See what happens with the string ";", how many fields do you have there? 2, your code will return only 1. Second, to use directly the pointer or a variable is only a style question, and don't modify the simplicity of the loop.
Regards,