Reading a text file new line and adding a new line

Hello folks I am practicing some polymorphism and the goal of one of my sub-classes is to transform a text file and add a an extra empty line between lines. EX

This is line 1
<----- extra space/double space
This is line 2

The current set up I have is that if a character is a new line, add double spaces.
My question are aside from why is this not working, but can a character even be a '\n'? I tested this function by changing the condition in which a character is a certain letter than add the new line and it works as intended.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  // Double Space Transform
char DoubleSpace::transform(char letter)
{
	if (letter == '\n')
	{
		return '\n';
	}
	else
	{
		return letter;
	}
}

//Here is the method responsible for altering the files, 
//depending on which version of the transform function is used
void FileFilter::doFilter(ifstream& inputFile, ofstream& outputFile)
{
	char ch, transCh;
	inputFile.get(ch);

	while (!inputFile.fail())
	{
		transCh = transform(ch);
		outputFile.put(transCh);
		inputFile.get(ch);
	}

	inputFile.close();
	outputFile.close();
}


Sadly this is not having an affect on the document and it just makes a copy of the original. I took a look at the ascii character set and it seems that there is no such character as a new line in the list.
Topic archived. No new replies allowed.