Difference: CSC121F2023Lab09Hint2 (1 vs. 2)

Revision 22024-03-05 - CathyBareiss

Line: 1 to 1
 
META TOPICPARENT name="CSC121F2023Lab09"

Help to load a file into an array

Changed:
<
<
  • Because you don't know the size, you need to read until the end of the file (no longer has.Next())
>
>
  • 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

Revision 12023-06-22 - cathybareiss

Line: 1 to 1
Added:
>
>
META TOPICPARENT name="CSC121F2023Lab09"

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.
 
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