Linking in DOS2PAS.LIB Versus PASCAL.LIB

Product Version(s): 3.20
Operating System:   MS-DOS
Flags: ENDUSER | TAR17027
Last Modified: 30-SEP-1988    ArticleIdent: Q10402

Question:

When the following program is linked with the DOS2PAS.LIB, it behaves
differently than when linked with just the PASCAL.LIB (which has the
DOS Version 1.x I/O package).

When linked with the DOS Versions 2.x I/O package DOS2PAS.LIB, the
program seems to lag one character behind. When the "f.mode :=
terminal;" is omitted, similar behavior is experienced. What is the
difference between terminal I/O and sequential binary mode?

The following is a short example code:

   PROGRAM xx(input,output);
   VAR C : char;
   F : file of char;
   BEGIN
   assign(f,'con');
   F.MODE := terminal;
   reset(f);
   writeln('end program with an "@"');
   while c<>'@' do begin
   read(f,c);
   if (c <> chr(0)) then begin
   write(c);
   writeln(ord(c))
   end
   end
   END.

Response:

No corrective action needs to be taken. The test programs are geared
to DOS Version 1.25. DOS Version 1.25 uses a polling model for console
I/O. If no input is in the queue DOS returns a 0. Thus, the line "if
chr(c) <> 0" skips over calls that returned no input. DOS Versions
2.0x use a different method, e.g. wait for input. Because the test is
geared for DOS Version 1.25, the DOS Version 2.00 release always seems
to be one character behind.

For information about the difference between terminal and sequential
mode, see Section 8.4 of the "Microsoft Pascal Compiler Reference
Manual."

Note: in the Version 3.30 release, only the DOS Versions 2.x I/O
interface will be supported.

