Page 287 - Learn to Program - Basic-256
P. 287
Chapter 18: Files – Storing Information For Later. Page 271
27 end subroutine
28
29 subroutine addrecord(f)
30 input "Name to add? ", name
31 input "Phone to add? ", phone
32 open f
33 # seek to the end of the file
34 seek size()
35 # we are at end of file - add new line
36 writeline name + ", " + phone
37 close
38 end subroutine
Program 115: Big Program - Phone List
phonelist.kbs - Manage your phone list.
Add, List, Quit (a/l/q)? l
the file is 46 bytes long
jim, 555-5555
sam, 555-7777
doug, 555-3333
Add, List, Quit (a/l/q)? a
Name to add? ang
Phone to add? 555-0987
Add, List, Quit (a/l/q)? l
the file is 61 bytes long
jim, 555-5555
sam, 555-7777
doug, 555-3333
ang, 555-0987
Add, List, Quit (a/l/q)? q
Sample Output 115: Big Program - Phone List
© 2019 James M. Reneau (CC BY-NC-SA 3.0 US)

