I can share the algo with you.

Parse the characters of the file and check for // or /* but remember that they should not be under the string literal ""

Now if you find // which is not under the string literal then ignore the line
if you find /* and its not in the string literal then ignore till */
Else you write everything to the new file.

I hope it helps.