[m-rev.] diff: handle opening binary files in .NET

Peter Ross pro at missioncriticalit.com
Mon Nov 17 04:06:33 AEDT 2003


Hi,

With this patch mercury_compile in IL can now build programs.

===================================================================


Estimated hours taken: 0.25
Branches: main

library/io.m:
	Allow "rb", "wb" and "ab" as arguments to open files.

Index: library/io.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.311
diff -u -r1.311 io.m
--- library/io.m	14 Nov 2003 10:56:14 -0000	1.311
+++ library/io.m	16 Nov 2003 16:43:41 -0000
@@ -4742,17 +4742,17 @@
         System.IO.Stream     stream = null;
 
 	try {
-		if (openmode == ""r"") {
+		if (openmode == ""r"" || openmode == ""rb"") {
 			// Like '<' in Bourne shell.
 			// Read a file.  The file must exist already.
 			mode   = System.IO.FileMode.Open;
 			access = System.IO.FileAccess.Read;
-		} else if (openmode == ""w"") {
+		} else if (openmode == ""w"" || openmode == ""wb"") {
 			// Like '>' in Bourne shell.
 			// Overwrite an existing file, or create a new file.
 			mode   = System.IO.FileMode.Create;
 			access = System.IO.FileAccess.Write;
-		} else if (openmode == ""a"") {
+		} else if (openmode == ""a"" || openmode == ""ab"") {
 			// Like '>>' in Bourne shell.
 			// Append to an existing file, or create a new file.
 			mode   = System.IO.FileMode.Append;


-- 
Peter Ross		
Software Engineer                                (Work)   +32 2 757 10 15
Mission Critical                                 (Mobile) +32 485 482 559
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list