Revision: 76543
          http://sourceforge.net/p/brlcad/code/76543
Author:   brlcad
Date:     2020-07-28 04:59:37 +0000 (Tue, 28 Jul 2020)
Log Message:
-----------
more binary. get dpix-pix working on windows.

Modified Paths:
--------------
    brlcad/trunk/src/util/dpix-pix.c

Modified: brlcad/trunk/src/util/dpix-pix.c
===================================================================
--- brlcad/trunk/src/util/dpix-pix.c    2020-07-28 04:55:28 UTC (rev 76542)
+++ brlcad/trunk/src/util/dpix-pix.c    2020-07-28 04:59:37 UTC (rev 76543)
@@ -67,8 +67,11 @@
        bu_exit(1, "Usage: dpix-pix file.dpix > file.pix\n");
     }
 
+    setmode(fileno(stdin), O_BINARY);
+    setmode(fileno(stdout), O_BINARY);
+
     ifname = bu_file_realpath(argv[1], NULL);
-    if ((fd = open(ifname, 0)) < 0) {
+    if ((fd = open(ifname, O_RDONLY|O_BINARY)) < 0) {
        perror(ifname);
        bu_free(ifname, "ifname alloc from bu_file_realpath");
        exit(1);
@@ -136,8 +139,7 @@
            *cp++ = mm * (*dp++) + bb;
        }
 
-       /* fd 1 is stdout */
-       got = write(1, (char *)&cha[0], count*sizeof(cha[0]));
+       got = write(stdout, (char *)&cha[0], count*sizeof(cha[0]));
        if (got < 0 || (size_t)got != count*sizeof(cha[0])) {
            perror("write");
            exit(2);

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
brlcad-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to