InputOut

L

Leonard

I want to read de characters in an array : ok but I want them to
display on the screen with OutputStreamWriter, but
nothing happens, what's wrong. I know there's a better way, but I want
to do it this way.

public class IO
{

public static void main (String[]args)
{
System.out.println("Geef een zin in");
Writer uitvoer = new OutputStreamWriter(System.out); //
streaming to screen


char[]buf = new char[250];
Reader invoer = new InputStreamReader(System.in);


try{
invoer.read(buf); //ok
uitvoer.write(buf); //nothing appear
}
catch(IOException ioe)
{
System.out.println("fout bij inlezen");

}
 
P

Phi

an OutputStreamWriter may be buffered, so flush() it ...
I want to read de characters in an array : ok but I want them to
display on the screen with OutputStreamWriter, but
nothing happens, what's wrong. I know there's a better way, but I want
to do it this way.

public class IO
{

public static void main (String[]args)
{
System.out.println("Geef een zin in");
Writer uitvoer = new OutputStreamWriter(System.out); //
streaming to screen


char[]buf = new char[250];
Reader invoer = new InputStreamReader(System.in);


try{
invoer.read(buf); //ok
uitvoer.write(buf); //nothing appear
uitvoer.flush(); // write immediately and don't buffer
 
L

Lew

Please do not top post.
an OutputStreamWriter may be buffered, so flush() it ...

Which is the answer given to your question when you multiposted it to
comp.lang.java.help as "IO problem". That was rather unfair to those trying to
help you. You should cross post instead, when you feel the need to approach
multiple newsgroups at once.

-- Lew
 
P

phi

Lew said:
Please do not top post.


Which is the answer given to your question when you multiposted it to
comp.lang.java.help as "IO problem". That was rather unfair to those
trying to help you. You should cross post instead, when you feel the
need to approach multiple newsgroups at once.

-- Lew


Sorry, does "top post" mean, I should not add my Answer to the top of
the question?
Anyway, it was not my intention to add anything to
"comp.lang.java.help", because I only subscribed to
"comp.lang.java.programmer".
Can anybody help me with this "cross post" thing? How does "cross post"
work. How do I enable (or disable) it?
What acutally is a "Followup-To:" (I can choose it in my Thunderbird
Mail Client, but I have no Idea what it means).

Thanks

phi
 
J

Joshua Cranmer

Sorry, does "top post" mean, I should not add my Answer to the top of
the question?
Anyway, it was not my intention to add anything to
"comp.lang.java.help", because I only subscribed to
"comp.lang.java.programmer".
Can anybody help me with this "cross post" thing? How does "cross post"
work. How do I enable (or disable) it?
What acutally is a "Followup-To:" (I can choose it in my Thunderbird
Mail Client, but I have no Idea what it means).

Thanks

phi
In Thunderbird, to cross-post you would type something like:

Newsgroup: | *** comp.lang.java.programmer, comp.lang.java.help

or:

Newsgroup: | *** comp.lang.java.programmer
Newsgroup: | *** comp.lang.java.help

(The ***'s are my attempt to denote the little rolodex-card-thingy)
Followup-To is basically the newsgroup version of Reply-To: it just
tells the client to default to following up to the selected newsgroup(s).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top