Is this programme writing data to a actual text file ??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gautamz07
    New Member
    • Sep 2013
    • 26

    #1

    Is this programme writing data to a actual text file ??

    Code:
    int i; 
    FileInputStream fin; 
    FileOutputStream fout; 
    try { 
    			// open input file 
    	try { 
    	fin = new FileInputStream(args[0]); 
    	} catch(FileNotFoundException e) { 
    	
    	System.out.println("Input File Not Found"); 
    	return; 
    	} 
    					// open output file 
    try { 
    	fout = new FileOutputStream(args[1]); 
    	} catch(FileNotFoundException e) { 
    	System.out.println("Error Opening Output File"); 
    	return; 
    	} 
    	} catch(ArrayIndexOutOfBoundsException e) { 
    	System.out.println("Usage: CopyFile From To"); 
    	return; 
    } 
    					// Copy File 
    	try { 
    	do { 
    	i = fin.read(); 
    	if(i != -1) fout.write(i); 
    	} while(i != -1); 
    	} catch(IOException e) { 
    	System.out.println("File Error"); 
    	} 
    		fin.close(); 
    		fout.close(); 
    	} 
    }
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    What are you asking here?
    You should be able to open the text file and see for yourself.

    Comment

    Working...