| 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) |
| QTIPS - Command Line Options |
| QTIPS - Invalid Code and Command |
| QTIPS - Code/Command Help |
| Utility Diskette # 4 |
| 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 |
| Creating Your Own Background Processes |
| @ATTACK - @Last.Select.Process |
| Reader's Forum |
| QTIPS - Menu Item Pre-Processing |
| Reader's Clinic - Functions and Subroutines |
| Reader's Letters - Jim Owen |
| Playing with Scan Codes |
| Argument passing - Subroutines and Functions - Mike Pope |
| 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 |
RevMedia FKB
| Document | V1I6A3 |
| Title | DOS Interfacing (Part II) |
| Keywords | DOS OSOPEN OPEN SETPTR IMPORT.READ INP OUT FILE.SIZE DISKSIZE STATUS |
| Text | Issue 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) |
Page last modified: 08/02/03