RandomAccessFil e readName = null;
RandomAccessFil e nameWriter= null;
List<String> Names = new ArrayList<Strin g>();
char[] pan= new char[19];
char[] cardName= new char[23];
try{
readName= new RandomAccessFil e(persoNames + "/perso.txt","rw" );
nameWriter= new RandomAccessFil e("C:/perso.txt","rw" );
for (String line = readName.readLi ne(); line != null;
line = readName.readLi ne()) {
if (line != null){
//readName.
line.getChars(0 ,19,pan,0);
line.getChars(1 9,42,cardName,0 );
nameWriter.writ eChars(pan.toSt ring());
I tried to use the above code to write the info in the character array to a file. I get the correct thing first time then later I get garbage.
Could you direct me to any web resources to help me correct the code.
RandomAccessFil e nameWriter= null;
List<String> Names = new ArrayList<Strin g>();
char[] pan= new char[19];
char[] cardName= new char[23];
try{
readName= new RandomAccessFil e(persoNames + "/perso.txt","rw" );
nameWriter= new RandomAccessFil e("C:/perso.txt","rw" );
for (String line = readName.readLi ne(); line != null;
line = readName.readLi ne()) {
if (line != null){
//readName.
line.getChars(0 ,19,pan,0);
line.getChars(1 9,42,cardName,0 );
nameWriter.writ eChars(pan.toSt ring());
I tried to use the above code to write the info in the character array to a file. I get the correct thing first time then later I get garbage.
Could you direct me to any web resources to help me correct the code.
Comment