TIP: Click on subject to list as thread! ANSI
echo: quik_bas
to: ALL
from: ROBERT KOHL
date: 1998-05-13 21:37:00
subject: CodeFAQ Part 7 of 11

------------------------ CodeFAQ Part 7 of 11 -------------------
[begin]
   INPUT "Enter the file to open:  ", File$
   FileThere% = 1          'assume the file is there
   ON ERROR GOTO FileNotFound
   OPEN File$ FOR INPUT AS #1
   ON ERROR GOTO 0
   IF FileThere% = 1 THEN  'if we haven't been proven wrong,
      PRINT "The file exists."
   ELSE
      PRINT "The file does not exist."
   END IF
   END
   FileNotFound:
   SELECT CASE ERR
      CASE 53: FileThere% = 0    'File not found!!
   END SELECT
[end]
   Another method is to use INTERRUPTs.  If you use this one,
   be sure to load QB with the /L switch.  Code by Joe Negron.
[begin]
   DEFINT A-Z
   DECLARE FUNCTION Exist% (FileName$)
   '***************************************************************
   '* FUNCTION Exist%                                             *
   '*                                                             *
   '* PURPOSE                                                     *
   '*    Uses DOS ISR 21H, Function 4EH (Find First Matching      *
   '*    Directory Entry) to determine the existence of FileName$.*
   '***************************************************************
   FUNCTION Exist% (FileName$) STATIC
      DIM IRegsX AS RegTypeX, ORegsX AS RegTypeX
      IRegsX.ax = &H4E00
      IRegsX.cx = &H3F                   'search for all files
      FileName$ = FileName$ + CHR$(0)    'must end with null byte
      IRegsX.ds = VARSEG(FileName$)      'load DS:DX with
      IRegsX.dx = SADD(FileName$)        'address of FileName$
      InterruptX &H21, IRegsX, ORegsX
      Exist% = ORegsX.ax = 0             'if ax contains a value,
                                         'remove the null byte
      FileName$ = LEFT$(FileName$, LEN(FileName$) - 1)
   END FUNCTION
[end]
8) HOW DO I PERFORM A COLD/WARM BOOT THROUGH QB?
   Cold boot:
   OUT &H64, &HFE
   Warm boot:
   DEF SEG = &HFFFF
   CALL ABSOLUTE(0)
9) HOW CAN I PRINT TEXT IN A GRAPHICS MODE WITHOUT DESTROYING
   THE BACKGROUND?
   The problem with PRINTing text on top of graphics is that
   QB blacks out the entire character box for each character
   you print.  That means that the graphics underneath your
   new text are just erased from the screen.  Not good, in some
   cases.  The following routine by Douglas Lusher is a very good
   substitute for the PRINT command, as it offers styles for two
   different graphics modes.  Just "comment-out" the statements
   for the mode you don't want to use, and "un-comment" those that
   you do want to use.  Note:  if you use the style for VGA
   modes, you must load QB with the /L switch.
[begin]
   SUB GPrint (X%, Y%, Text$, Culler%)
   'this routine allows printing text at any pixel location
   '     in the graphics modes without disturbing the background
   'by Douglas H. Lusher, 06-08-1996
   ' 8 x 8 char box, CGA
   CharSegment% = &HFFA6: CharOffset% = &HE
   CharWid% = 8: CharHgt% = 8
   ' 8 x 16 char box, VGA
   'DIM Register AS RegTypeX
   'Register.AX = &H1130
   'Register.BX = &H600
---------------------- CodeFAQ ends Part 7 of 11 ----------------
Robert (Bob) Kohl  Rio Rancho, New Mexico
Home Page:  http://www.geocities.com/SiliconValley/Way/7854
            http://members.tripod.com/~Bob_Kohl/index.html
Internet: bobakohl@abq.com  bobakohl1@juno.com  barbarianh@aol.com
--- Blue Wave/DOS v2.30
(1:301/45)
---------------
* Origin: * Binary illusions BBS * Albuquerque, NM * 505.897.8282 *

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.