VARPTR(#filenumber) Not Supported in QB 4.x or BC 6.00, 7.00 (46720)



The information in this article applies to:

  • Microsoft QuickBASIC 4.0
  • Microsoft QuickBASIC 4.0b
  • Microsoft QuickBASIC 4.5
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
  • Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0

This article was previously published under Q46720

SUMMARY

Instead of passing the file number (#n) to the VARPTR function for a random access file, you may use VARPTR to take the address of the first variable defined in the FIELD statement to return the address of the FIELD buffer.

This information applies to Microsoft QuickBasic Versions 4.00, 4.00b, and 4.50 for MS-DOS, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, and to Microsoft Basic PDS Version 7.00 for MS-DOS.

MORE INFORMATION

In QuickBasic Versions 2.00, 2.01, and 3.00, the VARPTR function can be passed the file number (#n) of a previously OPENed file. For sequential access files, VARPTR(#n) then returns the starting address of the disk I/O buffer assigned to that file number. For random access files, VARPTR(#n) returns the address of the FIELD buffer assigned to that file number.

In QuickBasic Versions 4.00, 4.00b, and 4.50 (and in the Basic compiler Versions 6.00 and 6.00b and Basic PDS 7.00), you cannot use VARPTR with a file number (#n) as an argument. This feature has been eliminated. You can now use the FILEATTR function, which returns the Basic access mode and the DOS file handle, which may be useful for DOS file interrupts.

Modification Type:MinorLast Reviewed:1/8/2003
Keywords:KB46720