bufferedreader - Skipping a character in java -


I try to write a code that is reading data from a file and writing it to another file And should also include the functionality to leave a specific character from my input file and then it should be written in another file.

  import java.io. *; Class Test {Public Static Zero Main (string [] args throws IOException {// open new fileReader in streams ("input.txt"); BufferedReader br = new BufferedReader (in); FileWriter Out = New FileWriter ("output.txt"); Buffett Vitter BW = New Baffed Vetter (Out); Int c = 0; While ((c = in.read ())! = -1) {in .read (); Bw.write ((four) c); } Br.close (); Bw.close (); }}  

I want to leave the character one from the input file data, and say my input file is name: ABC

I have to type Nme: bc in the output file. But instead I'm getting nm:. BC in the output file

I also try to use () the method of BufferedReader but it still give the right output Is not it

itemprop = "text">

leave

There is also a reading () call, so the loop is reading two letters, but only one of them is writing. Just check your character and do not forget to write it, if you want to leave it:

  while ((c = in.read ())! = -1) {char asChar = ( Four) c; If (asChar! = CharToSkip) bw.write (asChar); }  

Comments