Re: Reading a table




pete <pfiland@xxxxxxxxxxxxxx> wrote in message
news:474FA534.35B1@xxxxxxxxxxxxxxxxx
Bill Reid wrote:

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.

Yeah, I guess you're right, from a completely strict interpretation
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



.



Relevant Pages