home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Zodiac Super OZ
/
MEDIADEPOT.ISO
/
FILES
/
13
/
N_B_V203.ZIP
/
FILEOPEN.DMO
< prev
next >
Wrap
Text File
|
1996-07-04
|
3KB
|
54 lines
$if 0
┌──────────────────────────╖ PowerBASIC v3.20
┌──┤ DASoft ╟──────────────────────┬──────────────────╖
│ ├──────────────────────────╢ Copyright 1995 │ DATE: 1995-10-01 ╟─╖
│ │ FILE NAME FILEOPEN.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-NB01.INC"
$INCLUDE "DAS-NB02.INC"
COLOR 7,0
CLS
? "┌────────────────────────────────────────────────────────────────────────
? "│ LOCKon ()
? "│ LOCKoff ()
? "│ fCreateFile% ( FileSpec$, Handle% )
? "│ fOpenFile% ( FileSpec$, Handle% )
? "│ CloseFile ( FileNo% )
? "├──────────────────────────────────────────────────────────────────────────
? "│ This suite of routines simply creates/opens and closes binary files. If
? "│ you have first called LOCKon then the whole file will be locked after it
? "│ is opened and UNLOCKed before it is closed. Handle% is the returned value
? "│ of DOS's file handle that is used by the read/write functions.
? "│ fOpenFile% will NOT open a file if it does not first exist and will kill
? "│ and close the file if it has a length of 0!
? "├──────────────────────────────────────────────────────────────────────────
? "│ fShareLoaded? () returns 255 if SHARE.EXE is loaded
? "├──────────────────────────────────────────────────────────────────────────
? "│ The importance of fShareLoaded? is that files, records, and/or bytes of
? "│ a file cannot be LOCKed if SHARE.EXE has not been loaded and an attempt
? "│ by your program(s) to do so will create error 73 and/or 75.
? "└──────────────────────────────────────────────────────────────────────────
?
LOCKon ' turn on locking if SHARE.EXE has been loaded
LOCKoff ' turn it off ( we don't need it here anyhow )
FileNo% = fOpenFile% ( "DUMMY.DAT", Handle% )
'FileNo% = fCreateFile%( "DUMMY.DAT", Handle% ) ' unrem this line
IF FileNo% = 0 THEN PRINT "DUMMY.DAT NOT OPENED!" : END
PUT$ #FileNo%, "hello world"
CloseFile FileNo%