• Advertisement

Archived

This topic is now archived and is closed to further replies.

[java] Reading pre-defined data into an array??

This topic is 6107 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I want to be able to read a list of predefined x positions into a two dimensional array, the x relating to the horizontal position of an object. Is it possible to read these in from an external text file or will I have to hard code them. Thanks for any help. nowan

Share this post


Link to post
Share on other sites
Advertisement
Ugh, sorry, not a two dimensional array a ''one'' dimensional array.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
yeah, use java.io.BufferedReader to read files, the argument in the constructor should be a new FileReader with the argument for that constructor being the filename. However you will need a way to figure out how big to make the array. You can either read it in first or read into a Vector and get an array out of that.

Share this post


Link to post
Share on other sites

  • Advertisement