I'm trying to process an input file containing numbers that I must use for calculations and characters I need to use for comparisons. A quick example is a file like this:
6
foobar
and code like this:
n = readInInt
while n > 0
c = readInSingleChar
if (c = 'f')
doSomething
n--
Currently I'm finding a lot of options on here and via Google, involving DataStream and BufferedReader and FileReader, but there seems like there are too many ways and I'm not sure they all work how I need them too. Please let me know if my need isn't clear.
In short, I need to read a file character by character, and interpret/use those that are numbers as ints, and those that are letters and symbols as chars.
What's the simplest way to do this? I know there are professional ways to do things, and "ok" ways to do things. This is for a one-time, hobby-like personal use thing and I'm not looking for solid or robust functionality. It just has to work alright.
Thanks!