Tags:
create new tag
view all tags

Help to load a file into an array

  • Because you don't know the size, you need to read until the end of the file (no longer has.next())
  • Because you need to return the size of the array, the array to stored the data in must be passed.
  • Because you need to pass the array, it needs to be instantiated before it is sent. It need not be initialized before you load because loading is initializing
  • If there is more data than the maximum, you may
    • let the error occur and the program fail
    • handle the error in an appropriate manner. If you choose this option, discuss it in lessons learned
  • A method may return a value (such as the number of items read), but that value need not be used.
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2024-03-05 - CathyBareiss
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback