Thursday, December 12, 2013

Ejercicio 3

// Autor: Juan Antonio Ripoll
// Fecha: 03/10/13

// Descripción:
/*
   REALIZA UN PROGRAMA QUE LEA CARÁCTER A CARÁCTER DE UN FICHERO QUE SE LE 
   PASE COMO PARAMETRO, Y CONVIERTA A MAYÚSCULAS EN EL FICHERO TODAS LAS 
   LETRAS “a”. UTILIZA LA CLASE RANDOMACCESSFILE.
 */

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.RandomAccessFile;


public class Main 
{
	public static void main(String[] args) throws IOException 
	{		
		File file;
		
		if (args.length != 1)
		{
			InputStreamReader c = new InputStreamReader(System.in); 
			BufferedReader in = new BufferedReader(c);
			
			System.out.print("Introduzca la ruta del archivo: "); 
			file = new File( in.readLine() );
		}
		else
			file = new File( args[0] );
		
		
		RandomAccessFile randomAccessFile = new RandomAccessFile( file, "rw" );
		
		System.out.println("Buscando coincidencias en archivo ...");
		
		for (int i=0;i

No comments:

Post a Comment