how do I put the readChar bit into a file and save it for a rainy day? Or can I? I don't have a gui interface so I can't use getText() I just want what the user types in up until the user presses enter. Thx in advance J
If you want to capture an entire line of input you might consider wrapping a BufferedReader around your existing reader and using the readLine() method to capture input. Then you can store the input in a string and do with it as you please. That would look something like this:
To write the string to a file, you will need to open an outputStream and a writer to the file and then pass the string to the writer.
Bodie - Dude, Thanks a heap It took a whole nite of typing and trying things while downloading as much as possible from napster. But I finally got it to work. I couldn't however, get the writer bit to work. Here is what my code looks like PLEASE feel free to point out better ways or critism or mercilously mock it as you wish:
Jay, your code looked pretty good. I made some changes (most were stylistic) and got it to work. The problem that I seem to have with writing to files is that Windows NT doesn't recognize filenames as being relative. I have to specify a full path. If I don't, the file stream doesn't get created. There is probably something you can do with the string to indicate that it is relative to your JVM, but I don't really know what that would be, so I always give a full path and filename. Anyway! Try this: