Re: stream io in c
- From: rlb@xxxxxxxxxxxxxxxxxxxxxx (Richard Bos)
- Date: Thu, 31 Jul 2008 09:33:15 GMT
Ron Ford <ron@xxxxxxxxxxxxxxx> wrote:
On Thu, 31 Jul 2008 01:26:25 +0000, Richard Heathfield posted:
Ron Ford said:
FILE *fp;
char name[]="text58.txt";
fp=&name;
question. What on earth do you think this assignment means? Why did you
type it? (Answering that question might be the most important way you can
learn from this thread.)
LHS is a pointer. Since I could not create a sensical thingamajig of type
FILE--everything I tried was a syntax error--I tried chars. There's no
guarantees on pointers like this; why would there be a prohibition?
That's a nice example of magical thinking. "This looks, in one trivial
detail, like that; therefore, this should work, in all essentials, like
that." No. A pointer to FILE and a pointer to array of char are quite
different, and what's much more important, a FILE and an array of char
are very different. If you want to be a programmer, you must learn to
make sure that you _know_, rather than guess.
Richard
.
- References:
- stream io in c
- From: Ron Ford
- Re: stream io in c
- From: Ron Ford
- Re: stream io in c
- From: Richard Heathfield
- Re: stream io in c
- From: Ron Ford
- stream io in c
- Prev by Date: Re: stream io in c
- Next by Date: Re: stream io in c
- Previous by thread: Re: stream io in c
- Next by thread: Re: stream io in c
- Index(es):
Relevant Pages
|