![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
From REF |
#3
| |||
| |||
|
|
From REF basic.%open Command basic.%open C Function/BASIC Program Applicable release versions: AP/Unix Category BASIC Program (486) Description opens the Unix file specified by "string" and sets the file status flags according to the value of "oflag". Files opened by %open() are closed automatically when the Pick/BASIC programs terminates. Valid values of "oflag" are defined in the include fcntl.h. Combinations of the modes are obtained by adding several flags together from the following list: O$RDONLY Opens for reading only. O$WRONLY Opens for writing only. O$RDWR Opens for reading and writing. O$NDELAY Non blocking I/O. The effect of this flag varies depending on the type of the file. See the Unix Programmer's Reference Manual. O$APPEND Moves the file pointer to the end of the file. O$SYNC Sync writes. O$CREAT If the file exists, this flag has no effect. Otherwise, owner ID and group ID are set and the mode of the file is set according to the value of mode modified as follows: all bits in the file mode creation mask of the process are cleared and the sticky bit is cleared. O$TRUNC If the file exists, its length is set 0. O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file exists. The file descriptor is returned as a number or "-1" if an error occurred. System(0) contains the error number. Syntax file.descriptor=%open(string, oflag {, mode }) Options Example include dm,bp,unix.h fcntl.h fd=%open( '/usr/pick/fname', O$WRONLY+O$APPEND ) if fd<0 then crt 'Cannot open. errno=':system(0) end Apart from that, a 'search' of dm,bp, gives around 30 programs you could look at |
#4
| |||
| |||
|
|
Thanks Ross - but I think that only applies to *nix and I'm working on XP Pro on my PC at home. The old version of PSRM gave both the *nix and DOS versions, while the latest version of PSRM seems to apply only to *nix, and the DOS version had 3 arguments (or parameters) (something like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory - as opposed to the 2 (+mode) for the *nix version. I couldn't find any details on the fflgs & eflgs. Cheers Mike. Ross Ferris wrote: From REF basic.%open Command basic.%open C Function/BASIC Program Applicable release versions: AP/Unix Category BASIC Program (486) Description opens the Unix file specified by "string" and sets the file status flags according to the value of "oflag". Files opened by %open() are closed automatically when the Pick/BASIC programs terminates. Valid values of "oflag" are defined in the include fcntl.h. Combinations of the modes are obtained by adding several flags together from the following list: O$RDONLY Opens for reading only. O$WRONLY Opens for writing only. O$RDWR Opens for reading and writing. O$NDELAY Non blocking I/O. The effect of this flag varies depending on the type of the file. See the Unix Programmer's Reference Manual. O$APPEND Moves the file pointer to the end of the file. O$SYNC Sync writes. O$CREAT If the file exists, this flag has no effect. Otherwise, owner ID and group ID are set and the mode of the file is set according to the value of mode modified as follows: all bits in the file mode creation mask of the process are cleared and the sticky bit is cleared. O$TRUNC If the file exists, its length is set 0. O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file exists. The file descriptor is returned as a number or "-1" if an error occurred. System(0) contains the error number. Syntax file.descriptor=%open(string, oflag {, mode }) Options Example include dm,bp,unix.h fcntl.h fd=%open( '/usr/pick/fname', O$WRONLY+O$APPEND ) if fd<0 then crt 'Cannot open. errno=':system(0) end Apart from that, a 'search' of dm,bp, gives around 30 programs you could look at |
#5
| |||
| |||
|
|
It works the same on NT. Just substitute DOS for *nix. |
|
There's a file to include depending on exactly what you're doing, dm,bp,includes Check out D3Ref account, D3.DOC for A0 = BASIC.%] Unless you are dealing with binary items or incredibly large items, you might be better off just opening the file via OSFI. Mark Brown |
|
michael (AT) preece (DOT) net> wrote in message news:1131509570.306834.214380 (AT) z14g2000cwz (DOT) googlegroups.com... Thanks Ross - but I think that only applies to *nix and I'm working on XP Pro on my PC at home. The old version of PSRM gave both the *nix and DOS versions, while the latest version of PSRM seems to apply only to *nix, and the DOS version had 3 arguments (or parameters) (something like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory - as opposed to the 2 (+mode) for the *nix version. I couldn't find any details on the fflgs & eflgs. Cheers Mike. Ross Ferris wrote: From REF basic.%open Command basic.%open C Function/BASIC Program Applicable release versions: AP/Unix Category BASIC Program (486) Description opens the Unix file specified by "string" and sets the file status flags according to the value of "oflag". Files opened by %open() are closed automatically when the Pick/BASIC programs terminates. Valid values of "oflag" are defined in the include fcntl.h. Combinations of the modes are obtained by adding several flags together from the following list: O$RDONLY Opens for reading only. O$WRONLY Opens for writing only. O$RDWR Opens for reading and writing. O$NDELAY Non blocking I/O. The effect of this flag varies depending on the type of the file. See the Unix Programmer's Reference Manual. O$APPEND Moves the file pointer to the end of the file. O$SYNC Sync writes. O$CREAT If the file exists, this flag has no effect. Otherwise, owner ID and group ID are set and the mode of the file is set according to the value of mode modified as follows: all bits in the file mode creation mask of the process are cleared and the sticky bit is cleared. O$TRUNC If the file exists, its length is set 0. O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file exists. The file descriptor is returned as a number or "-1" if an error occurred. System(0) contains the error number. Syntax file.descriptor=%open(string, oflag {, mode }) Options Example include dm,bp,unix.h fcntl.h fd=%open( '/usr/pick/fname', O$WRONLY+O$APPEND ) if fd<0 then crt 'Cannot open. errno=':system(0) end Apart from that, a 'search' of dm,bp, gives around 30 programs you could look at |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Thanks Ross - but I think that only applies to *nix and I'm working on XP Pro on my PC at home. The old version of PSRM gave both the *nix and DOS versions, while the latest version of PSRM seems to apply only to *nix, and the DOS version had 3 arguments (or parameters) (something like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory - as opposed to the 2 (+mode) for the *nix version. I couldn't find any details on the fflgs & eflgs. Cheers Mike. Ross Ferris wrote: From REF basic.%open Command basic.%open C Function/BASIC Program Applicable release versions: AP/Unix Category BASIC Program (486) Description opens the Unix file specified by "string" and sets the file status flags according to the value of "oflag". Files opened by %open() are closed automatically when the Pick/BASIC programs terminates. Valid values of "oflag" are defined in the include fcntl.h. Combinations of the modes are obtained by adding several flags together from the following list: O$RDONLY Opens for reading only. O$WRONLY Opens for writing only. O$RDWR Opens for reading and writing. O$NDELAY Non blocking I/O. The effect of this flag varies depending on the type of the file. See the Unix Programmer's Reference Manual. O$APPEND Moves the file pointer to the end of the file. O$SYNC Sync writes. O$CREAT If the file exists, this flag has no effect. Otherwise, owner ID and group ID are set and the mode of the file is set according to the value of mode modified as follows: all bits in the file mode creation mask of the process are cleared and the sticky bit is cleared. O$TRUNC If the file exists, its length is set 0. O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file exists. The file descriptor is returned as a number or "-1" if an error occurred. System(0) contains the error number. Syntax file.descriptor=%open(string, oflag {, mode }) Options Example include dm,bp,unix.h fcntl.h fd=%open( '/usr/pick/fname', O$WRONLY+O$APPEND ) if fd<0 then crt 'Cannot open. errno=':system(0) end Apart from that, a 'search' of dm,bp, gives around 30 programs you could look at |
#8
| |||
| |||
|
#9
| |||
| |||
|
|
Hi Somebody had a brainstorm and combined the NT and Unix versions. Just to make it more interesting they did not change the Unix name nor did they tell anybody. You need INCLUDE DM,BP,UNIX.H FCNTL.H;* Yes this does apply to NT and you need to use COMPILE ITEM (C) Peter McMurray michael (AT) preece (DOT) net> wrote in message news:1131509570.306834.214380 (AT) z14g2000cwz (DOT) googlegroups.com... Thanks Ross - but I think that only applies to *nix and I'm working on XP Pro on my PC at home. The old version of PSRM gave both the *nix and DOS versions, while the latest version of PSRM seems to apply only to *nix, and the DOS version had 3 arguments (or parameters) (something like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory - as opposed to the 2 (+mode) for the *nix version. I couldn't find any details on the fflgs & eflgs. Cheers Mike. Ross Ferris wrote: From REF basic.%open Command basic.%open C Function/BASIC Program Applicable release versions: AP/Unix Category BASIC Program (486) Description opens the Unix file specified by "string" and sets the file status flags according to the value of "oflag". Files opened by %open() are closed automatically when the Pick/BASIC programs terminates. Valid values of "oflag" are defined in the include fcntl.h. Combinations of the modes are obtained by adding several flags together from the following list: O$RDONLY Opens for reading only. O$WRONLY Opens for writing only. O$RDWR Opens for reading and writing. O$NDELAY Non blocking I/O. The effect of this flag varies depending on the type of the file. See the Unix Programmer's Reference Manual. O$APPEND Moves the file pointer to the end of the file. O$SYNC Sync writes. O$CREAT If the file exists, this flag has no effect. Otherwise, owner ID and group ID are set and the mode of the file is set according to the value of mode modified as follows: all bits in the file mode creation mask of the process are cleared and the sticky bit is cleared. O$TRUNC If the file exists, its length is set 0. O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file exists. The file descriptor is returned as a number or "-1" if an error occurred. System(0) contains the error number. Syntax file.descriptor=%open(string, oflag {, mode }) Options Example include dm,bp,unix.h fcntl.h fd=%open( '/usr/pick/fname', O$WRONLY+O$APPEND ) if fd<0 then crt 'Cannot open. errno=':system(0) end Apart from that, a 'search' of dm,bp, gives around 30 programs you could look at |
#10
| |||
| |||
|
|
Peter, I believe you mean use the "O" option to flash-compile, not the C option which removes extra bytes from the object code. Mike, if you want interprocess comms, good luck bud. I wish we could malloc memory, carve it up into logical segments, then make various segments available for other processes to peek/poke the same way. If someone knows a way to do this that's cross-platform compatible and doesn't require linking new C code into the D3 monitor, please let me know - just show me where the fish are, I don't need a fish. According to RD those %functions are just transparent pass-through's to their host OS C counterparts, so if you look up the functions in other development areas on the net you will find the info you need. Some info won't be easy to find, I warn you, but it's out there. Glen and I can both attest, however, that there are some funky aspects of the %functions that most definitely don't behave as expected. As you know, some functions are Unix or NT only, and there are a couple that have different commands (not just arguments) depending on the platform. Final tidbit, when a parameter requires a numeric field, remember that this is a C typed numeric and not a generic MV untyped variable. To coerce variables into numeric you might need to add zero to them. As in: result = %function(iamastring+0) HTH T "Peter McMurray" <excalibur21 (AT) bigpond (DOT) com> wrote: Hi Somebody had a brainstorm and combined the NT and Unix versions. Just to make it more interesting they did not change the Unix name nor did they tell anybody. You need INCLUDE DM,BP,UNIX.H FCNTL.H;* Yes this does apply to NT and you need to use COMPILE ITEM (C) Peter McMurray michael (AT) preece (DOT) net> wrote in message news:1131509570.306834.214380 (AT) z14g2000cwz (DOT) googlegroups.com... Thanks Ross - but I think that only applies to *nix and I'm working on XP Pro on my PC at home. The old version of PSRM gave both the *nix and DOS versions, while the latest version of PSRM seems to apply only to *nix, and the DOS version had 3 arguments (or parameters) (something like "Syntax file.descriptor=%open(string, fflgs, eflgs)" - from memory - as opposed to the 2 (+mode) for the *nix version. I couldn't find any details on the fflgs & eflgs. Cheers Mike. Ross Ferris wrote: From REF basic.%open Command basic.%open C Function/BASIC Program Applicable release versions: AP/Unix Category BASIC Program (486) Description opens the Unix file specified by "string" and sets the file status flags according to the value of "oflag". Files opened by %open() are closed automatically when the Pick/BASIC programs terminates. Valid values of "oflag" are defined in the include fcntl.h. Combinations of the modes are obtained by adding several flags together from the following list: O$RDONLY Opens for reading only. O$WRONLY Opens for writing only. O$RDWR Opens for reading and writing. O$NDELAY Non blocking I/O. The effect of this flag varies depending on the type of the file. See the Unix Programmer's Reference Manual. O$APPEND Moves the file pointer to the end of the file. O$SYNC Sync writes. O$CREAT If the file exists, this flag has no effect. Otherwise, owner ID and group ID are set and the mode of the file is set according to the value of mode modified as follows: all bits in the file mode creation mask of the process are cleared and the sticky bit is cleared. O$TRUNC If the file exists, its length is set 0. O$EXCL If O$EXCL and O$CREAT are set, open will fail if the file exists. The file descriptor is returned as a number or "-1" if an error occurred. System(0) contains the error number. Syntax file.descriptor=%open(string, oflag {, mode }) Options Example include dm,bp,unix.h fcntl.h fd=%open( '/usr/pick/fname', O$WRONLY+O$APPEND ) if fd<0 then crt 'Cannot open. errno=':system(0) end Apart from that, a 'search' of dm,bp, gives around 30 programs you could look at |
![]() |
| Thread Tools | |
| Display Modes | |
| |