"nemadrias" <> wrote in message
news: oups.com...
> How do I write to a file (using a FileWriter) from a filled vector??
>
> I.E. Why can't I do this??
>
> for (i = 0; i < myVector.size(); i++){
> myWriter.write(myVector.elementAt(i));
> myWriter.flush();
> 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
http://www.iviz.com/