The code snippets in these messages are Cache over OS X (a flavor of Unix), not Windows. Both GTM and Cache seem to use the Unix file names to identify devices, but the parameters may be different. In my opinion, something as basic as simple I/O has no business being left up to the implementation. Yes, in C it is all done through a library, but that library is part of the ANSI standard.
 
Incidentally (or maybe not so incidentally), this is why VistA code (excepting infrastructure) is not allowed to use OPEN, CLOSE or USE with parameters. Instead, the same functionality is available in platform independent form through the Kernel device handler (%ZIS, %ZISC and the %ZISH and %ZISL libraries).

Nancy Anthracite <[EMAIL PROTECTED]> wrote:
Greg Woodhouse and I were corresponding about this just recently because of
something I was trying to figure out. This particular part I thought might
be helpful to you. It explains the "WNS" I see when I am importing routines
with %RI - they are parameters.

**************
Anyway...

When you open a file for writing you normally obtain an exclusive
lock (or you can't open it), but if you're just going to throw away
the file contents, gaining an exclusive lock *may* not be necessary
(hence the "S"[Nancy note- Share]). The "N" (for new version) means you throw
away the file contents on all platforms except VMS. On VMS, you would get a
series of file versions: TMP.TXT;1, TMP.TXT;2, etc. You can open
files for reading, writing or both, but opening a file that doesn't
already exist will normally fail:

USER>O "/tmp/junk.txt":"RW"

O "/tmp/junk.txt":"RW"
^

USER>D ^%CLI

CLI command: touch /tmp/junk.txt

USER>O "/tmp/junk.txt":"RW"

USER>C "/tmp/junk.txt"

USER>

(The Unix command "touch" just opens and closes a file, having the
effect of creating it if it doesn't already exist.) It seems that
Cache doesn't have a "C" flag, but "N" is semantically equivalent to
passing the "c" flag to fopen() in C. So, if you prefer, just think
of "N" as "create".


On Wednesday 16 November 2005 10:31 am, K.S. Bhaskar wrote:
Eddie / Kevin --

IO parameters in M are different for each implementation (yes, the
standard is to be different). You will have more luck with the GT.M
Programmers Guide
(http://www.sanchez-gtm.com/user_documentation/GTM-PG-UNIX44/index.htm)
in this area.

-- Bhaskar

On Wed, 2005-11-16 at 08:34 -0600, Eddie Hagood wrote:
> Hey all,
>
&g t; This is Kevin T. I am working with Eddie Hagood, who is new in our
> office and interested in learning M (Great!).
>
> We are going through some example codes, and I am having a hard time
> explaining the OPEN command. We have R. Walters book, and he gives
> examples like this:
> OPEN 1,2:("C":"DATAFILE.TXT")
> ...
> USE 2 READ RECORD
> ...
>
> I, on the other hand, in the past have found and copied code like
> this:
> SET FNAME="/tmp/mytext.txt"
> OPEN FNAME
> USE FNAME
> WRITE "TEXT OUT GOES HERE."
> USE $P
>
>
> I know that OPEN has LOTS of parameters, but I don't understand the
> "1,2" above. Is this assigning the output file a device number or
> something?
>
> Also, how do I specify overwriting vs. appending?
>
> Thanks
> Kevin & Eddie.

-------------------------------------------------------
This SF.Ne t email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

--
Nancy Anthracite


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc. Get Certified Today
Register for a JBoss Training Course. Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members


===
Gregory Woodhouse  <
[EMAIL PROTECTED]>

"Einstein was a giant. He had his head in the clouds and his feet on the ground."

-- Richard P. Feynman


Reply via email to