Need help! Encoding from a file.
Been working on this for a while now.. :s:
The idea is to "encode" a text file, then pass it on to the console and also a new file. Such as taking input from a text file that reads "Hello" and convert it for output reading "ifmmp". Each character value gets 1 added to it. Also each line of input should transfer to a "coded" line of output, then go to the next line.
The closest I can get to it is either just displaying the first line or if I change it to 'println' it displays everything, but as single characters per line.
Any help would be much appreciated!
Code:
char sNew;
String sOld = fin.readLine();
while ((sOld = fin.readLine()) != null)
{
for (int i = 0; i < sOld.length(); i++)
{
if (i < sOld.length())
{
sNew = (char)(sOld.charAt(i) + 1);
System.out.print(sNew);
fout.print(sNew);
}
} //for
} //while