
-----------------------------------
Fifa4ever
Fri Apr 20, 2012 5:35 pm

Rot13 encryption problem
-----------------------------------
MY problem is that I can not seem to be getting any information from "test.txt" 
 the other thing i need is i need to then encrypt "test.txt" and save it in a file specified by the user.
im pretty stuck, because my teacher is not much help at all. 

menu class


// import and package//
package rot;
import java.io.*;
public class Menu {
	
			
		 public static void main ( String

class with all my methods in it 


package rot;

import java.util.Formatter;
import java.util.Scanner;
import java.io.*;
public class Writetofile {
    
	//Ciper u = new Ciper ();
    int y; 	
	private Formatter k;
	public Scanner x;
	String plaintext;
	String fileName = new String ();		

    String str;
    FileWriter fw;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));	
	
    
    public void openFile(String o){
		try {
			System.out.println("Messages.txt  be encrypted or decrypted:");
	    	x = new Scanner (new File (o));
		}
		catch (Exception e) {
			System.out.println("Could not find file.Bye!");
		}
	}
   

	
	public void closeFile () { 
		k.close(); 
	}
	

	 
	public String readFile(String o){
	while (x.hasNextLine()){
	System.out.println(x.nextLine());&#65279;
		
	}
	return o;
	
			}
	


public void encrypt(){
		y = plaintext.length();
		char

-----------------------------------
Zren
Sat Apr 21, 2012 3:40 am

RE:Rot13 encryption problem
-----------------------------------
Assuming you didn't forget to uncomment the function calls...


//g.openFile(); 
public void openFile(String o){ 


What's wrong with the first line after looking at the second?


As for writing to a file: http://lmgtfy.com/?q=bufferedwriter+example You can also use the PrintWriter class if you want similar methods to those found in System.out.*.

Actually, I'm amazed the teacher isn't helping you with a standard in/out task. Did you skimp reading course reading?

-----------------------------------
Fifa4ever
Sat Apr 21, 2012 2:52 pm

Re: Rot13 encryption problem
-----------------------------------
okay so i believe that i will now be able to write to a new file. I just need help in actually reading the file. maybe someone could check over my readtofile method . If anyone has the time to check it over, would be appreciated!

-----------------------------------
Zren
Sun Apr 22, 2012 11:41 pm

RE:Rot13 encryption problem
-----------------------------------
This reads a file fine:


public class Test {
	public static void main(String

I don't see why it wouldn't work unless it's the way you've structured your code. Does your menu work?

-----------------------------------
Fifa4ever
Mon Apr 23, 2012 8:19 am

Re: Rot13 encryption problem
-----------------------------------
alright got some free time on my hands, ill get back if i need anymore help
