Tom Schneider wrote:
Peter:
No. We use one of the mechanisms to specify the file name at run-time from a string.
UCSD Pascal:
reset ( MyFile, 'myfile.dat' );
Borland Pascal:
assign ( MyFile, 'myfile.dat' ); reset ( MyFile );
ISO Extended Pascal:
Var MyFile: File of whatever; B: BindingType; unbind ( MyFile ); B:= binding ( MyFile ); B.Name:= 'myfile.dat'; bind ( MyFile, B ); reset ( MyFile );
All this works in GPC.
Right, and I consider that to be "machine dependent"
Not machine dependent, but compiler dependent, that's a big difference! It will work on any machine, as long as it's compiled with GPC.
since such things are not available on all Pascal compilers. So I avoid them.
Well, at least the 3rd mechanism is specified in the Extended Pascal standard (ISO 10206), while your way (derving the file name from the variable name) is not standardized and therefore also compiler dependent...
Frank