Article View: comp.os.msdos.programmer
Article #7919Re: open vs fopen?
From: Dan Pop
Date: Tue, 20 Feb 1996 15:13
Date: Tue, 20 Feb 1996 15:13
73 lines
3961 bytes
3961 bytes
In <4gbdfr$l2a@newshost.cyberramp.net> sinan@cyberramp.net (John Noland) writes: >The original question was something to the effect of, "What is the difference >between fopen and open and when should I use one over the other?". Are you >saying I should have answered with, "They are functionally identical. There >is no difference between them, whatsoever. Always use fopen(), PERIOD!!!". For comp.lang.c, read/write and fread/fwrite _are_ functionally identical and "Always use fopen(), PERIOD!!!" is the right message that has to be sent to c.l.c readers. Those who're really interested in the differences should be sent to a platform specific newsgroup, because the differences _are_ platform specific. >>The stdio buffering is a red herring, because it can be always disabled, if it >>isn't needed. > >That's true. But if you're going to disable it, why not use the other routines? >They're smaller. I guess portablity would be a valid reason. The stdio routines >are ANSI and the others aren't. The stdio routines provide more functionality: what's the raw I/O equivalent of fscanf? A very good reason to prefer stdio even if you decide (for whatever reason) to disable the stdio buffering. >>In my <stdio.h> file, the constant BUFSIZ is 512. > >>Aha, I see where the magical value 512 came from. The systems I'm working >>on have BUFSIZ set to values between 1024 (mostly BSD-based Unices) and >>32768 (OpenVMS). So, your claim that <stdio.h> sets the size of the >>buffer to 512 bytes is bogus. BTW, even 512 is a humongous size for a >>single density 8" floppy disk, which needs to read four sectors to fill >>such a buffer. > >This has an extemely condescending feel to it. Aha? Magical value? >Your claim that <stdio.h> sets the size of the buffer? The clouds >have parted. I see clearly now. Dan has bestowed upon me the titles >C NEWBIE and UNIX Illiterate. >BUFSIZ is in <stdio.h>. To say that the size of the buffer is set **IN** >the stdio.h file is not wrong or misleading. Right. But to say that the value of BUFSIZ is set to 512 in <stdio.h> is both wrong and misleading. Saying: "on my system/platform/compiler BUFSIZ is set to 512 in <stdio.h>" would have been perfectly OK, although fairly irrelevant, since neither comp.os.msdos.programmer nor comp.lang.c are dedicated to your particular compiler. >Not by any stretch of the >imagination. But you managed anyway. Since this thread is running in >both the c.l.c and msdos.programmer groups, I used the value most DOS >compilers use. And leading other people to believe that it is universal is OK, isn't it? Especially in the context of c.l.c, where the value used by most DOS compilers is utterly irrelevant. >Again,sorry Dan. It just seemed like you were bragging about UNIX and >putting down DOS (god forbid). Could you post the paragraphs (from this particular thread) which gave you this impression? >DOS is inferior to UNIX in almost every respect. Why isn't UNIX the >most dominant OS in the world? Are you sure this question belongs to these newsgroups? Keep your cheap sarcasms for yourself, please. Dan -- Dan Pop CERN, CN Division Email: danpop@mail.cern.ch Mail: CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
Technical Details
Message-ID:
<danpop.824829220@rscernix>Path:
arc1-ca.pugleaf.net!rcp6.elan.af.mil!rscernix!danpopReferences:
<uEYFxc9nX8WX083yn@mbnet.mb.ca> <4f8bev$6tr@hermes.louisville.edu> <2d3avbl60.alamito@marketgraph.xs4all.nl> <4ftusv$181@newshost.cyberramp.net> <danpop.824430285@rscernix> <4g39d4$ej8@newshost.cyberramp.net> <danpop.824525964@rscernix> <4gbdfr$l2a@newshost.cyberramp.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!rcp6.elan.af.mil!rscernix!danpop From: danpop@mail.cern.ch (Dan Pop) Newsgroups: comp.os.msdos.programmer,comp.lang.c Subject: Re: open vs fopen? Date: 20 Feb 96 15:13:40 GMT Organization: CERN European Lab for Particle Physics Message-ID: <danpop.824829220@rscernix> References: <uEYFxc9nX8WX083yn@mbnet.mb.ca> <4f8bev$6tr@hermes.louisville.edu> <2d3avbl60.alamito@marketgraph.xs4all.nl> <4ftusv$181@newshost.cyberramp.net> <danpop.824430285@rscernix> <4g39d4$ej8@newshost.cyberramp.net> <danpop.824525964@rscernix> <4gbdfr$l2a@newshost.cyberramp.net> NNTP-Posting-Host: ues5.cern.ch X-Newsreader: NN version 6.5.0 #7 (NOV)