import java.io.*;

public class NoFileLocking {
    public static void main( String[] args ) {
	int delay = 1000;
	int len = 5;
	String id = args[0];
	String file = args[1];
	String what = args[2];
	try {
	    RandomAccessFile fw = new RandomAccessFile( file, "rws" );
	    fw.seek( fw.length() );

	    for( int i = 0; i < len ; i++ ) {
		Thread.sleep( delay );
		for( int j = 0; j < what.length(); j++ ) {
		    fw.write( (byte)what.charAt(j) );
		}
		System.out.println( id + " " + fw.getFilePointer() );
	    }
	    fw.close();
	}
	catch( Exception ex ) {
	}
    }
}
