Re: Reading a table
- From: "Bill Reid" <hormelfree@xxxxxxxxxxxxxxxx>
- Date: Fri, 30 Nov 2007 15:18:47 GMT
pete <pfiland@xxxxxxxxxxxxxx> wrote in message
news:474FA534.35B1@xxxxxxxxxxxxxxxxx
Bill Reid wrote:Yeah, I guess you're right, from a completely strict interpretation
Roland Pibinger <rpbg123@xxxxxxxxx> wrote in message
news:474f17f2.627932@xxxxxxxxxxxxxxxxx
On Tue, 27 Nov 2007 02:19:55 GMT, "Bill Reid" wrote:
if((text_file=fopen(text_file_path,"rt"))==NULL) {
- with an explanation for "rt" instead of "r"
Read the friggin' man page!
That's the problem.
Man pages aren't part of the C programming language.
Using "rt" as a second argument in a fopen function call
isn't part of the C programming language either.
of the "standard"...except, of course, that the "standard" itself is
actually contradictory as a practical matter on the subject.
If "rt" is NOT a part of the "C programming language" (standard),
then of course it would be completely illegal to use "rt". But that's
NOT what the "standard" says, now is it?
Meanwhile, on my "implementation", there is a global file opening
mode variable that can be over-ridden by using either 't' or 'b'. Since
it is set to "O_TEXT" by default I don't actually NEED to use the "rt",
but since this has also been the case for several wildly-different
"implementations" in my experience, I am in the habit of setting it
that way. I suspect there aren't a lot of C compilers out there where
this would cause a problem, since a lot of them fudge around the
"undefined behavior" in their "man pages", explicitly allowing the
"rt" while acknowledging it is a waste of a character...
But, I guess you're "technically" correct, I should have noted that
to open a text file under the "C standard" you only need to use "r",
and "rt" MIGHT cause a "portability" problem...
---
William Ernest Reid
.
- Follow-Ups:
- Re: Reading a table
- From: Keith Thompson
- Re: Reading a table
- References:
- Reading a table
- From: Stephen . Schoenberger
- Re: Reading a table
- From: user923005
- Re: Reading a table
- From: Stephen . Schoenberger
- Re: Reading a table
- From: Bill Reid
- Re: Reading a table
- From: Roland Pibinger
- Re: Reading a table
- From: Bill Reid
- Re: Reading a table
- From: pete
- Reading a table
- Prev by Date: Compile error on WinXP/MSVC++E05
- Next by Date: Re: Reading a table
- Previous by thread: Re: Reading a table
- Next by thread: Re: Reading a table
- Index(es):
Relevant Pages
|