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

Report as inappropriate.

Gevater_Tod4711 presents ...


File Reader/Writer (demo)

This demo contains some methods to load save and delete .txt files that can be used in any scenarios. They don't work on the Greenfoot webside so you have to download it to use the methods.
Descriptions how to use the methods can be find in the class File.

5024 views / 980 in the last 7 days

2 votes | 0 in the last 7 days

Tags: demo with-source

open in greenfoot
Your browser does not support the canvas tag.
A new version of this scenario was uploaded on Sat Mar 16 10:37:34 UTC 2013 Improved the writing of files. Now you can write text into a file and also add text to a existing file.
A new version of this scenario was uploaded on Mon Apr 01 15:26:10 UTC 2013 Improved the methods for saving and deleting files.


Can you add a method which will return the names of all the existing files?
Well I'm not sure how to do this but I'll try.
A new version of this scenario was uploaded on Wed May 29 17:47:56 UTC 2013 Added methods to get the names or objects of every file in a directory.
The methods I added can only get the filenames of the subdirectorys. Not of the directory where the .java and .class files are saved. Has anyone got an idea how I can get the pathname of this directory without knowing where the scenario is stored?

Want to leave a comment? You must first log in.

Who likes this?

RedVoltron Wasupmacuz