Java

Brian Densmore DensmoreB at ctbsonline.com
Fri Apr 30 20:15:19 CDT 2004


> -----Original Message-----
> From: Ben Coffman
> 
> I have a file I want to locate a word within the file and 
> then erase that 
> word without erasing the rest of the file.  So far all I can 
> get out of this 
> is to read in each character until I find the characters in 
> the order I need 
> and then I know the location of the word and where I need to delete.  
> Unfortunately I do not know how to go back into the file and 
> delete just the 
> specific characters I want to delete...I need to do this in Java.
> 
I can't give you the exact syntax, but:

/* pseudocode */
open file1 for read mode;
open ~file1 for write mode;
readln (file1,string);
string replace (string, string-to-delete, '');
writeln (~file1,string);
close file1;
close ~file1;
mv (~file1 file1);
/* end */

I know, I know ...
this looks more like Pascal than java.




More information about the Kclug mailing list