Results 1 to 4 of 4
Thread: Multiple line user input
- 10-25-2008, 08:19 PM #1
Member
- Join Date
- Oct 2008
- Posts
- 1
- Rep Power
- 0
Multiple line user input
I'm trying to write a program that accepts user input to find a particular file and perform a particular action. I can't seem to make it so that the user in Windows CMD can type multiple lines, like in a text file, rather than just one line at a time. I'd like to use readLine() or some equivalent after the user enters the information to read and disperse the various components, but i don't know if that's possible. This is the format of user input i need from the command prompt.
GET \userinfo\scenario4.txt
(blank line)
additional optional data(could be any length)
the blank line is an actual blank line. any help would be much appreciated.
- 10-25-2008, 09:53 PM #2
By definition readLine reads a line, not more than one line.I'd like to use readLine()
When reading from console input, how will you detect the end of the user's input? If optional data follows a blank line, then the user will have to signal end of input for the program to recognize it.
On some OSs there is a control key + letter combo to signal EOF.
I think it's Ctrl+C on Windows but am not sure.
To read more than one line, put the readLine() in a loop and continue reading until EOF is signalled.
- 10-26-2008, 02:29 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
I don't think in Windows command prompt you can enter multiple lines. I think Ctrl+C is the terminate command of e process, cannot use for EOF notification.
Since readLine() read a line-by-line, you can read all information through a single line by use of a special character separation, may be a comma or any other characters. Then you can process it in your application before read the file and so on. Just a tip.
- 10-26-2008, 02:41 AM #4
Similar Threads
-
how to get input from User
By Alvaro in forum New To JavaReplies: 7Last Post: 01-15-2010, 11:02 PM -
who to take user input ,not by console...
By Shyam Singh in forum New To JavaReplies: 3Last Post: 06-13-2008, 10:09 PM -
Prompting user input of a string.
By apfroggy0408 in forum New To JavaReplies: 3Last Post: 03-09-2008, 06:23 PM -
cant take input from user
By new_1 in forum New To JavaReplies: 6Last Post: 12-25-2007, 07:38 AM -
Multiple Line Input Dialog Box
By johnt in forum AWT / SwingReplies: 2Last Post: 05-31-2007, 09:30 PM


LinkBack URL
About LinkBacks

Bookmarks