Article View: aus.computers.java
Article #450Re: Help urgent !!!writing to file
From: Paul Murray
Date: Tue, 17 Oct 2000 00:00
Date: Tue, 17 Oct 2000 00:00
32 lines
1810 bytes
1810 bytes
"dennis" <dennisc@iprimus.com.au> wrote in message
news:39eaf0e7@news.iprimus.com.au...
> else if (arg.equals("End")){ // if it was End
> PrintWriter fout = Text.create("customer.out");
> System.out.println("printing to file");
> fout.println(Merits);
> fout.close();
> System.exit(0); // We exit
>
> The name of the list is Merits. I have imported java.io.*. When I compile
> with this code I get the error
> Undefined variable or class name: Text
Where did you get this
> PrintWriter fout = Text.create("customer.out");
line from? Did you just make it up? Copy it from a cookbook without
understanding it?
Sigh. Try this instead:
PrintWriter fout = new PrintWriter(new FileOutputStream("customer.out"));
And don't forget to close or at least flush it before the program exits.
It's still wrong - you'd be better off serializing your object or writing to
a Properties file - but at least you'll get output to look at.
--------------------------------------------------------------
Repent! Quit your job! Slack off!
http://www.users.bigpond.com/pmurray
ICQ: 26066755
Technical Details
Message-ID:
<ncTG5.3475$e5.8885@newsfeeds.bigpond.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<39eaf0e7@news.iprimus.com.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10d6db,982d9b52a8d5dfdc X-Google-Attributes: gid10d6db,public From: "Paul Murray" <pmurray@nospam.bigpond.com> Subject: Re: Help urgent !!!writing to file Date: 2000/10/17 Message-ID: <ncTG5.3475$e5.8885@newsfeeds.bigpond.com> X-Deja-AN: 682376197 References: <39eaf0e7@news.iprimus.com.au> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.3018.1300 X-Trace: newsfeeds.bigpond.com 971767699 139.134.124.146 (Tue, 17 Oct 2000 17:28:19 EST) Organization: Telstra BigPond Internet Services (http://www.bigpond.com) X-MSMail-Priority: Normal NNTP-Posting-Date: Tue, 17 Oct 2000 17:28:19 EST Newsgroups: aus.computers.java