Hi there, i am havingg trouble getting my results written to file, seems to be just the last line that is written, probably overwriting each line as it goes through the loop rather than writing to a new line.
How do i fix this?
Code:
if (myCC.getBand(start_band_position)!=null)
{
chromosomeBand myCB = new chromosomeBand(myCC.getB
and(start_band_position));
flpterRange myFLR = myCC.getFlpterRange(start_band
_position);
try {
int cytcounter = 1;
File cytotable = new File("/mnt/rinetapp1a/u
sers/devallp/src/demoChromosomeStuff/cytogenetic-assignment-table.txt");
File probetable = new File("/mnt/rinetapp1a/
users/devallp/src/demoChromosomeStuff/probe-table.txt");
FileWriter fw = new FileWriter(cytotable);
PrintWriter pw = new PrintWriter(fw);
pw.print(cytcounter + " " + myFLR.getStar
t() + " " + myFLR.getEnd() + " " + chromosome + " " + symbol);
fw.close();
System.out.println("The symbol is " + symbol
);
System.out.println("The chromosome is " + ch
romosome);
System.out.println("The band is " + myCB.get
Name());
System.out.println("With a start value of "
+myCB.getStart());
System.out.println("And an end value of " +
myCB.getEnd());
// flpterRange myFLR = myCC.getFlpterRange(st
art_band_position);
System.out.println("The flpterrange seems to
be from " + myFLR.getStart() + " to " + myFLR.getEnd());
cytcounter++;
break;
}
catch (IOException e) {
System.out.println("something wrong with io??");
} the standard out prints all the results no problem but there is only ever one line of results that is printed to file.
how do i get the results printed to file to print to a new line each time rather than writing over each previous line?
I guess it has to do with when the filewriter is closed but i can't seem to put it anywhere else and if i remove it completely i get no results to file.