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

2015/9/22

Creating txt file

someone1 someone1

2015/9/22

#
I would like to create a simple txt file, but the problem is that I want to use data already in another text file, Say for example that i want to create the text file MaleData and i have a second txt file called PersonInfo which has the name, height, weight and gender on one line and there are five lines all with different data(name, height, weight and gender). For my new text file(MaleData) I just want to get all the data and display it about the the person only if they are male so if three of the people in the PersonInfo text file were female, I would simply want the two records on my MaleData txt file Thanx
danpost danpost

2015/9/22

#
What part of this are you having trouble accomplishing? In general, you could read in the data file, placing each record in a List object, then output each element in that List object that does not represent a female person to the new file.
someone1 someone1

2015/9/22

#
Sry im not sure what you mean, i want to create a txt file using data from another existing txt file, im not to great at programming so could you show me how its done
danpost danpost

2015/9/22

#
someone1 wrote...
Sry im not sure what you mean, i want to create a txt file using data from another existing txt file, im not to great at programming so could you show me how its done
The code for reading and writing text files is not beginner level stuff. Maybe you can use the UserInfo storage for what you want to do. You will not be able to write any files on the site, anyway, due to security restraints.
You need to login to post a reply.