Software Archive
Read-only legacy content
17061 Discussions

reading from an open unit/file

Intel_C_Intel
Employee
204 Views
Can I open a unit (a text data file) in the main program and then have a read statement in a subroutine (with the unit still open in the main program) that reads from the same unit/file? do I need to pass the unit number to the subroutine? If so, will multiple calls to the subroutine simply advance the read pointer to the next line each time?

Any help is greatly appreciated!

Cheers!
Boyd
0 Kudos
1 Reply
Steven_L_Intel1
Employee
204 Views
Yes, you can do this. It's your choice as to whether or not to pass the unit number - it's just an integer. Open units are global to the program.

Steve
0 Kudos
Reply