I'm trying to write a program that asks a user for a file name, which contains a set of numbers. The program should should read the contents of the file into an array but I can't seem to correctly open the file. Can't someone tell me if i'm doing something wrong?
@SamualAdams, thats incorrect. the file should only be closed if it was opened successfully and after all reading is done. line 25 is the right place for it.
@OP
you need to explore the problem further, what error are you getting from inputFile when you try to open it? does the file really exist? is your program looking in the correct folder? perhaps line 20 should also output the error code so that you can look it up.
when you run the program try entering an absolute path to the test file and see if it finds it then.
line 20 should be outputting place+1 not numbers+1