You are not checking the return value of getline(). When it fails, no copy should be made. Btw, you are also depending on a final '\n' in the source file, otherwise you'll have trouble copying the last line.
Here's a form that monitors successful reads properly:
void copyStringNewFile(ifstream& inData, ofstream& outData)
{
char ch;
while (inData >> ch)
{
outData << ch;
}
}
Or if you're ready to use a more advanced form:
void copyStringNewFile(ifstream& inData, ofstream& outData)
{
outData << inData.rdbuf();
}