Need help with input & output files

I am working on a program to decode an encrypted file. The problem is an error I continue to get on line 29, I have it noted. I am not sure if this is the reason the plain2.txt file is empty. It creates the file, but it's a blank page.

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
31
32
33
34
35
36
37
38
39
40
41
//Tanya Reed Lab 10
//This program reads an encoded file
//then decodes the file.

#include <iostream>
#include <string>
#include <fstream>

using namespace std;
int main()
{
	string decodeLine;
	string readLine;
	fstream inputFile;
	fstream outputFile;
	int index;

	inputFile.open("coded.txt", ios::in);         //Opens file to read
	outputFile.open("plain2.txt", ios::out);    //Decoded file

	readLine = "";

	while (inputFile.good())                    //Reads file
	{
		inputFile >> readLine;
		decodeLine = "";
		index = 0;
			
		while (index < readLine.length())       //Decodes file      //Error 4018: signed/unsigned mismatch
		{
			decodeLine += (char)((int)readLine[index] - 5);
			index++;
		}

		outputFile << decodeLine << endl;
	}
	inputFile.close();
	outputFile.close();
	system("pause");
	return 0;
}
In the future, note the difference between an error and a warning. They're different, that's why they have different names.

A problem I see with this is that there's no guarantee that what gets encoded will get decoded exactly. For example, suppose I ask you take the number 856434569798 and add 1 to each digit, while leaving the 9s untouched.
856434569798
becomes
967545679899
And when you reverse,
956434569799
it's not the same number anymore.
This might be what's happening here, although I'm not sure if it accounts for the blank file.
Thanks for the reply, but it doesn't seem to apply to this issue!
Topic archived. No new replies allowed.