Reader's Clinic - Screen Width
VERBatim - V41
QTIPS - DOS File Names
DOS Interfacing (Part II)
VERBatim - V116
@ATTACK - @Pri.File
@ATTACK - @Rollout.File
File Variables
How Indexes Are Updated
Index Record Layouts
QTIPS - File Variable of File In SELECT Statement
QTIPS - Amending non-Attached Files
LINEAR HASH FILE STRUCTURES - Part 1
Index Flush
QTIPS - File Handle Structure
QTIPS - Break-On Date Fields
IConvs / OConvs
RTP Series - RTP9
DOS Interfacing (Part II)
@ATTACK - @File.Error
@ATTACK - @File.Error.Mode
@ATTACK - @Last.Error
A RevTechie Replies - And Miscellaneous Jottings - Mike Pope - Revelation Technologies (UK) Ltd
RTP5 and RTP51
QTIPS - Standardising Error Message Display
QTIPS - Interrupt Proof Error Messages
Version 3 Technical Highlights - ValidateName
Playing with Scan Codes
QTIPS - Compiling Protection Code
QTIPS - Invalid Code and Command
QTIPS - Code/Command Help
Compiling 64K on a Shoestring by Blaise Wrenn (LexStat Systems Ltd)
@ATTACK - @File.Error
@ATTACK - @Rn.Counter
Reader's Clinic - Related Windows
Directory Exists on Novell
DOS Interfacing (Part II)
REVMEDIA Revisited
Version 2
Directory Exists on Novell
Gas Bar
Prompt Help
DOS Interfacing (Part II)
@ATTACK - @Help.Level
@ATTACK - @StatList
QTIPS - Standardising Error Message Display
Video Control
Customising the Status Line
REVMEDIA Revisted
QTIPS - Command Line Options
QTIPS - Invalid Code and Command
QTIPS - Code/Command Help
Utility Diskette # 4
Merge Processor
QTIPS - Using INIT.VIEW with Printers
@ATTACK - @PDisk.On
How Indexes Are Updated
QTIPS - Unexpected/Unwanted Modification Of Record On Write
Reader's Clinic - Line Length > 256 Characters
QTIPS - String Space
QTIPS - String Space Format Errors
Reader's Forum - Numeric Precision in R/Basic - Hal Wyman
Reader's Clinic - Functions and Subroutines
Argument passing - Subroutines and Functions - Mike Pope
@ATTACK - @PDisk.On
QTIPS - Postscript Driver Problem
QTIPS - Assorted Oddments
A RevTI Techie Replies - Mike Pope - Revelation Technologies (UK) Ltd
QTIPS - File Naming - RLIST Problems
@ATTACK - @Modal
VERBatim - V39
Esc.To.Exit
Version 2
QTIPS - Invalid Code and Command
DOS Interfacing (Part II)
Reader's Clinic - Preventing Records Being Amended
How Indexes Are Updated
A RevTechie Replies - And Miscellaneous Jottings - Mike Pope - Revelation Technologies (UK) Ltd
Caching in on the Frames Array - Mike Pope
DOS Interfacing (Part II)
What's New (and un(der)documented!) In 2.12
Creating Your Own Background Processes
@ATTACK - @Last.Select.Process
Reader's Forum
QTIPS - Menu Item Pre-Processing
Utility Diskette # 4
QTIPS - Using @Upper.Case and @Lower.Case with Foreign Languages
Base Conversions
Utility Diskette # 3 - Part I
Sorting out Collation Sequences by Mike Pope
What's New (and un(der)documented!) In 2.12
QUERY.SUB
QTIPS - Query Windows - Changing Colours
Readers Clinic - Quickly Coping with \
VERBatim - V70
VERBatim - V123
VERBatim - V124
Reader's Clinic - Functions and Subroutines
Reader's Letters - Jim Owen
Playing with Scan Codes
Argument passing - Subroutines and Functions - Mike Pope
DOS Interfacing (Part II)
LINEAR HASH FILE STRUCTURES - Part 1
Caching in on the Frames Array - Mike Pope
DOS Interfacing (Part I)
DOS Interfacing (Part II)
Reader's Clinic - Different Id Same Record
RTP Series - RTP25
QTIPS - String Space
Reader's Letters - Jim Owen
QTIPS - Finding/Replacing Spaces With The Editor
QTIPS - Improving the LH_VERIFY Window
Utility Diskette # 3 - Part I
QTIPS - Moving Objects the EASY way.

RevMedia FKB

DocumentV1I6A3
TitleDOS Interfacing (Part II)
KeywordsDOS
OSOPEN
OPEN
SETPTR
IMPORT.READ
INP
OUT
FILE.SIZE
DISKSIZE
STATUS
TextIssue 4 considered the routines available for querying the DOS environment
This month's investigates the routines available for interfacing to DOS and
DOS file structures Whilst some of these routines are documented we will
consider how their use may be extended It is worth pointing out that this
article is NOT exhaustive there are other routines that can be used to
interface to DOS these will be covered at a later date


OSOPEN
Internal STATEMENT Used to open a DOS file for DIRECT access If an attempt
is made to open a DOS file that does not exist an error code of 4 will be
returned in STATUS() If an attempt is made to open a DOS subdirectory an
error code of 2 will be returned in STATUS() Thus to see if a DOS directory
exists OSOPEN it and check the status If the status is 2 the directory
exists if 2 a file exists WITH that name


OPEN
Internal STATEMENT The normal OPEN command can be used to access the
various DOS special devices Thus the printer could be addressed DIRECTLY by

OPEN "PRN" TO PRN FILE THEN
WRITE STRING TO PRN FILE
END


SETPTR
External subroutine (C or Assembler) Used by PDISK to redirect printer
output to file Passed Filename and Flag returns Flag indicating status or
requested operation Filename must be appended WITH a CHAR(0) (this tends to
imply a 'C' routine as 'C' uses CHAR(0) as an end of string marker) Flag
should be set on entry to 1 for overwrite existing file or 0 for no
overwrite

FILENAME = "C:\AREV\PRN DAT"
FILENAME := CHAR(0)
FLAG = 1
CALL SETPTR(FILENAME FLAG)

The exit conditions are unfortunately not just 0 or 1! They appear not to
conform to the standard OSOPEN error conditions but those of which I am
aware are

2 Invalid Path
3 No such path
5 Access denied
20 File exists
21 Redirected OK


IMPORT READ
External subroutine Used to read records sequentially FROM a DOS file With
this routine if the filename and dos delimiters/record length are known
the developer can sequentially access records in a DOS file without access
to OSBREAD! The CALLING syntax is

CALL IMPORT READ(A B C D E F G)

where

A is the DOS file var (OSOPENED)
B is the offset within the file
C is the record delimiter
D is the End of File marker
E is the record length
F is the record returned
G is a flag indicating OK (1) or EOF (2)

Thus to process all records in TEST DAT which is a CRLF delimited ASCII file
with Ctrl Z as EOF we would

OSOPEN "TEST DAT" TO A ELSE STOP
B = 0 ; * offset auto incremented
C = CHAR(13) : CHAR(10)
D = CHAR(26)
E = ""
F = "" ; G = ""
LOOP
UNTIL G = 2 DO
CALL IMPORT READ(A B C D E F G)
PRINT F
REPEAT

INP
Used to query a port address DIRECTLY As this is so HARDWARE specific it
can be dangerous to use as it is not portable

OUT
Used to output to a port address DIRECTLY As this is so HARDWARE specific
it can be dangerous to use as it is not specific

FILE SIZE
A function passed one parameter the name of the Revelation file that is
being sized The routine returns the size of the DOS file indicating the
overflow frames USING this in conjunction WITH the DISKSIZE function allows
the programmer to see whether there is enough space on disk for a file
before attempting to move it eg

DECLARE FUNCTION FILE SIZE DISKSIZE
DECLARE SUBROUTINE MSG
SPACE NEEDED = FILE SIZE("BP")
AVAILABLE = disksize("C")<2>
IF SPACE NEEDED > AVAILABLE THEN
MSG("ERROR No Room" "" "" "")
END ELSE
*
* TRANSFER logic here
*
END


(Volume 1 Issue 6 Pages 4 5)
[revmedia/copyrigh.htm]

Page last modified: 08/02/03