> How do I write to a file (using a FileWriter) from a filled vector??
>
[quoted text clipped - 5 lines]
> myWriter.close();
> }
You (sometimes) can't write to a writer after you've closed it.
- Oliver
> How do I write to a file (using a FileWriter) from a filled vector??
>
[quoted text clipped - 5 lines]
> myWriter.close();
> }
First, because you're closing the file after the first element. Move the
close statement to outside of the loop. Second, because write writes out a
String (or char [] or int). You must convert whatever the object is at
myVector.elementAt (i) to a String. Minimally you can use toString (), or
if it's a vector of strings you can cast to String but otherwise it should
be something intellligible. What are you expecting it to output?
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
nemadrias - 01 Aug 2006 21:13 GMT
Thanks to both of you -
I don't know how I moved the .close() statement into the loop, but
somehow overlooked it. I did a toString() and that worked fine.
Thanks alot Matt,
Steve
> > How do I write to a file (using a FileWriter) from a filled vector??
> >
[quoted text clipped - 14 lines]
>
> Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Hendrik Maryns - 02 Aug 2006 14:46 GMT
nemadrias schreef:
> Thanks to both of you -
> I don't know how I moved the .close() statement into the loop, but
> somehow overlooked it. I did a toString() and that worked fine.
Please don’t top-post.
I’d move flush outside the loop too. No need to have that much I/O.
H.
- --
Hendrik Maryns
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html