Click here to Skip to main content
15,879,474 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi all,
Iam trying to write the locations of points to afile but it only write "E" i don't know why it just write "E" in my file and didn't write the locations of points ...


Java
for( int i = 0; i < detector.getNumberOfFeatures(); i++ ) {
                    
            	 Point2D_F64 pt = detector.getLocation(i);
                     if( detector.hasScale() ) {
                             double scale = detector.getScale(i);
                             int radius = (int)(scale*          
                             render.addCircle((int)pt.x,(int)pt.y,radius);
                     }
                     else
                     {
                             render.addPoint((int) pt.x, (int) pt.y);
                     }
                //******to write location of point to file*********//
                     try {
                     	
                       File statText = new File("D:/Master/statsTest.txt");
                       FileOutputStream is = new FileOutputStream(statText);
                       OutputStreamWriter osw = new OutputStreamWriter(is);    
                       Writer w = new BufferedWriter(osw);
                     	       
                     	        w.write((int) pt.x);
                     	        w.write((int) pt.y);
                     	        
                     	        w.close();
                     	    } catch (IOException e) {
                   System.err.println("Problem writing to the file statsTest.txt");
                     	    }
                     
             }


or is there any Method i can use to write my output?
Regards
Posted
Updated 3-Mar-14 9:42am
v5
Comments
Sergey Alexandrovich Kryukov 3-Mar-14 15:24pm    
What "E"? I cannot see any "E". How about just using the debugger?
—SA
Bebo_1 3-Mar-14 15:39pm    
E--> which is written in my file"statsTest"
and i don't know why !!!

1 solution

instead of writing int values convert it to text and then save it like this. The problem here it is being written as binary format.

w.write((pt.x.tostring());
 
Share this answer
 
Comments
Bebo_1 3-Mar-14 15:50pm    
but i didn't work also ..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900