This site requires JavaScript, please enable it in your browser!
Greenfoot back
Psychpsyo
Psychpsyo wrote ...

2016/2/6

Reading from files

Psychpsyo Psychpsyo

2016/2/6

#
Hi, I have a problem with reading numbers from files. I need my method to read a number from a text file (not in the scenario folder) from line X and store it in a variable. How can I do this or where could I start? (and yes, i've tried to search on the internet, but I didn't understood most of it.)
danpost danpost

2016/2/7

#
First, you must understand, that if you code your project to access files outside your scenario folder, then it will not run anywhere but local to your system (nowhere on the web will it work). No advice will be given unless this is actually what you want.
Psychpsyo Psychpsyo

2016/2/7

#
Yes, I understand, that the code will ony work if it doesn't run on the web and the files exist on the system. That is exactly what I want and where I need help.
danpost danpost

2016/2/7

#
Psychpsyo wrote...
Yes, I understand, that the code will ony work if it doesn't run on the web and the files exist on the system. That is exactly what I want and where I need help.
Okay, which part of this are you having trouble with and what have you tried?
Psychpsyo Psychpsyo

2016/2/8

#
I tried to search in the Internet, but I didn't understood the explanations I found. So I'd like to know what scripts I need and how they work/how I use them. For example which parameters they need and what they do. The only thing I really understood is that you need a bufferedReader or so.
danpost danpost

2016/2/8

#
The java tutorial pages on Basic I/O should be of some help -- particularly the File I/O pages on the Path class and Reading, Writing and Creating files
You need to login to post a reply.