I need to make a program that will take in a program, strip all its `//` and `/* */` comments, and finally send that to a new file.

The problem I'm having is that I cannot figure out how to end the deletion of characters in a string by `s.erase` at the end of a line of the comment. I entered the whole program into a string, and now I have to find and erase the comments.

```
while (!(filein.eof()))
{
    ch=filein.get();
    s.insert(i,1,ch);
    i++;
}
for (i=0;i<s.length();i++)
{
    if((s.at(i) == '/') && (s.at(i+1) == '/'))
    {
        s.erase(i, '\n');
    }
}

```

I thought `s.erase(i, '\n')` will work but it only erases the first 10 characters.