| View previous topic :: View next topic |
| Author |
Message |
timb11783 Guest
|
Posted: Tue Nov 29, 2005 10:29 pm Post subject: problem writing doubles with java filewriter |
|
|
I can write strings fine but can't write doubles. Do I have to close
the file and try writing with another method?
|
|
| Back to top |
|
 |
Roedy Green Guest
|
Posted: Wed Nov 30, 2005 12:08 am Post subject: Re: problem writing doubles with java filewriter |
|
|
On 29 Nov 2005 14:29:02 -0800, "timb11783" <timb_11783 (AT) yahoo (DOT) com>
wrote, quoted or indirectly quoted someone who said :
| Quote: | I can write strings fine but can't write doubles. Do I have to close
the file and try writing with another method?
|
see http://mindprod.com/applets/fileio.html
for how to do almost any i/o.
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|
|
| Back to top |
|
 |
timb11783 Guest
|
Posted: Wed Nov 30, 2005 12:29 am Post subject: Re: problem writing doubles with java filewriter |
|
|
This does not help me
|
|
| Back to top |
|
 |
Roedy Green Guest
|
Posted: Wed Nov 30, 2005 12:52 am Post subject: Re: problem writing doubles with java filewriter |
|
|
On 29 Nov 2005 16:29:53 -0800, "timb11783" <timb_11783 (AT) yahoo (DOT) com>
wrote, quoted or indirectly quoted someone who said :
| Quote: | This does not help me
|
You gave almost no detail of what you were trying to do, so I could
only offer generic advice.
then see http://mindprod.com/applets/converter.html
for how to convert double <-> String
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
|
|
| Back to top |
|
 |
Paulus de Boska Guest
|
Posted: Wed Nov 30, 2005 11:24 am Post subject: Re: problem writing doubles with java filewriter |
|
|
Should be a new file :
FileOutputStream fos=new FileOutputStream (pathname) ;
DataOutputStream dos=new DataOutputStream(fos);
dos.writeUTF( somestring );dos.writeDouble( somedouble );
Paul Hamaker
http://javalessons.com
|
|
| Back to top |
|
 |
Thomas Fritsch Guest
|
Posted: Wed Nov 30, 2005 4:21 pm Post subject: Re: problem writing doubles with java filewriter |
|
|
timb11783 wrote:
| Quote: | I can write strings fine but can't write doubles. Do I have to close
the file and try writing with another method?
What do you want? Write out a double |
(1) as a human-readable String
or (2) as 8 raw bytes (IEEE-754 format) ?
--
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')
|
|
| Back to top |
|
 |
|