Original Post
howdy. I''ve come across a little snag in a current project of mine, and I was wondering if anyone could offer some insight as to why it is happening.
I prompt the user with a question, requiring a y/n type answer. I use:
selection = stdin.read();
to acquire the users selection.
everything seems fine and dandy up to this point.
immediately following this, I try to prompt the user for the name of a file:
filename = stdin.readLine();
now here''s my problem. It seems as if there''s something left in the.. umm.. "input buffer" <- definately isn''t the right wording, but i''m not well-versed in this lingo yet. Anyway, the program seems to initialize filename to absolutely nothing, and jump to the next statement in my program without prompting the user to enter a filename.
As far as I know, the problem lies in the read() statement that I used immediately before the readLine() statement. If i replace the beforementioned read() with a readLine() that performs the same task, the program works properly. What is it about the read() function that I''m missing?
Any info would be greatly appreciated
hmm.. also if anyone knows the procedure with respect to creating codeblocks within'' my posts on this forum, it''d be cool if ya let me know
groovy,
ern