Bill Cunningham said:
I think I might understand this now. For that fopen call perhaps I
should've used perror(fp); But I read in my book that there is a colon so I
'm going to go out on the limb here and say this,
perror(fp:"open error");
Does that look correct?
No, it looks stupid. It looks like you're making wild guesses and
posting them here without the slightest effort to find the real
answer.
perhaps I should've used perror(fp);
Where on Earth did you get that idea? fp is of type FILE*; you should
know, you declared it yourself. Does perror take an argument of type
FILE*? If you don't know, how would you find out *before* making a
fool of yourself by posting here?
You're calling a standard library fucntion
LOOK IT UP. You have a copy of K&R2; use it. It explains how to use
perror.
If you had even bothered to compile it before posting (and you should
never post code here if you haven't first tried to compile it), you
would have gotten an error message from the compiler.
But I read in my book that there is a colon so I'm going to go out
on the limb here and say this,
perror(fp:"open error");
That's a syntax error. The limb just broke under you.
You read in your book that "there is a colon"? What does that even
mean? It didn't say that there's a colon in the call to perror, did
it? You saw the word "colon" somewhere, and this prompted you to add
a ':' character to a function call. Whatever thought process led you
to think that *might* be a good idea is fundamentally flawed.
Re-read what I told you two months ago today:
http://groups.google.com/group/comp.lang.c/msg/6da991ad26d30ed9