Skip to main content

Problem:

Does the main program lose the file pointer of the record it is positioned at on sequential reads if the called program reads the same file? How about when the main program writes a record to a file and then calls a program that reads and writes to the same file?

 

Solution:

When you are using an “external” only one file pointer exists. So, if the main program opens record-file and reads records 1, 2, and then the pointer stops at record 3, then calling subprogram will start at the next record, record 4. From there you return to the main program, doing a read on that file your pointer will be a record 5.