|
Hi everyone, I just joined this community in hope, that you might be able to help me.
Tuesday I gotta hand in a project for uni and it all works alright.
Except for the input.
The thing is, I want to read from a text-file and then I want keyboard input aswell.
At first I read the text-file by writing "java myprogramm < file.txt"(>) on the console, which works alright, but then I also wanted to read stuff from the keyboard. I used "StdIn.readDouble();", but Java still tries to read from the text-file because this is now my standard input stream.
So, the question is: Is there a way to switch between input streams? How do I do that?
(I also tried reading my file with FileReader, but even though my class-file and the text-file are in the same directory it tells me FileNotFoundException...)
I searched the net and API, but I can't find anything. Your help would be very much appreciated, since I'm running out of time here!
Thanks in Advance,
~Sam~
EDIT: Thanks for you help everyone, problem solved! (Well, a new one arose, but isn't it always like that?... *g*)
|