[rrd-developers] fopen call inside rrd_open.c

Alex van den Bogaerdt alex at ergens.op.HET.NET
Fri Jun 21 23:58:08 MEST 2002


Hi,

Just looking at some code.

I noticed this:

    #ifndef WIN32
            mode = "r";
    #else
            mode = "rb";
    #endif
        } else {
    #ifndef WIN32
            mode = "r+";
    #else
            mode = "rb+";
    #endif

According to my manual:

       The mode string can also include the letter  ``b''  either
       as  a last character or as a character between the charac-
       ters in any of the two-character strings described  above.
       This  is  strictly for compatibility with ANSI X3.159-1989
       (``ANSI C'') and has no effect; the ``b''  is  ignored  on
       all  POSIX  conforming  systems,  including Linux.  (Other
       systems may treat text files and binary files differently,
       and adding the ``b'' may be a good idea if you do I/O to a
       binary file and expect that your program may be ported  to
       non-Unix environments.)

So I'm wondering if this piece of code (and possibly other code)
shouldn't just read:

            mode = "rb";
        } else {
            mode = "rb+";

which looks nicer, and should in theory be better anyway (...good idea...)

Anyone knows why it isn't just asking for binary mode in any case?

cheers
-- 
   __________________________________________________________________
 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
+----------------------------------------------------------------------+
| Technical questions sent directly to me will be nuked. Use the list. | 
+----------------------------------------------------------------------+
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |
+----------------------------------------------------------------------+

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-developers mailing list