home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
R&W-NUM.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
4KB
|
71 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME R&W-NUM .DMO ║ by ╘════════════════─ ║ ║
│ │ ║ Don Schullian, Jr. ║ ║
│ ╘══════════════════════════╝ ║ ║
│ A license is hereby granted to the holder to use this source code in ║ ║
│ any program, commercial or otherwise, without receiving the express ║ ║
│ permission of the copyright holder and without paying any royalties, ║ ║
│ as long as this code is not distributed in any compilable format. ║ ║
│ IE: source code files, PowerBASIC Unit files, and printed listings ║ ║
╘═╤═════════════════════════════════════════════════════════════════════╝ ║
│ .................................... ║
╘═══════════════════════════════════════════════════════════════════════╝
$endif
'.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
$INCLUDE "DAS-NB02.INC"
COLOR 7,0
CLS
? "┌────────────────────────────────────────────────────────────────────
? "│ fWriteB? (Handle%, Value?) fReadB? (Handle%)
? "│ fWriteW? (Handle%, Value??) fReadW?? (Handle%)
? "│ fWriteI? (Handle%, Value%) fReadI% (Handle%)
? "│ fWriteL? (Handle%, Value&) fReadL& (Handle%)
? "│ fWriteD? (Handle%, Value???) fReadD??? (Handle%)
? "├──────────────────────────────────────────────────────────────────────
? "│ These 10 functions will read/write numeric variables directly from/to
? "│ a file.
? "│ fWriteX? returns 0 if everything went OK or the DOS error
? "│ fReadX? returns the value that has been read
? "│ They do offer a slight savings in typing, time, and program size but
? "│ their biggest benefit is in ease of understanding the written code
? "├─────────────────────────────────────────────────────────────────────────────
? "│ SEE: FSEEK.TXT
? "└────────────────────────────────────────────────────────────────────────
'┌────────────────────────
F$ = "DUMMY.DAT" '│ a junk file
B? = 10 '│ some variables
W?? = 20 '│
I% = 30 '│
L& = 40 '│
D??? = 50 '│
'│
OPEN "B", #1, F$ '│ open the file
Handle% = FILEATTR( 1, 2 ) '│ get DOS's file handle
'│
fWriteB Handle%, B? '│ write the data
fWriteW Handle%, W?? '│ PUT$ #1, MKWRD$( W?? )
fWriteI Handle%, I% '│
fWriteL Handle%, L& '│
fWriteD Handle%, D??? '│
'│
PRINT F$; '│ display file size
PRINT USING " IS ## BYTES LONG"; LOF(1) '│
PRINT '│
SEEK #1, 0 '│ reset file to top
'│
PRINT USING "B? = ##" ; fReadB? ( Handle% ) '│ GET$ #1, 2, D$
PRINT USING "W?? = ##" ; fReadW?? ( Handle% ) '│ W?? = CVWRD( D$ )
PRINT USING "I% = ##" ; fReadI% ( Handle% ) '│
PRINT USING "L_& = ##"; fReadL& ( Handle% ) '│
PRINT USING "D??? = ##" ; fReadD???( Handle% ) '│
'│
CLOSE #1 '│ close the file
fKILLfile F$ '│ keep your HD clean!