tags:

views:

123

answers:

7
+2  Q: 

Regarding stdio.h

Hi everyone,

Confession: I am a novice.

Question: I was checking out stdio.h, but I could not find the definition of the fopen function. Can somebody please tell where can I find the definition?

regards,

bug.

+1  A: 

If you're using unix or linux you can find it with:

man fopen

Otherwise, just google for man fopen and you'll find it.

You can use man for pretty much any standard library function.

Nathan Fellman
This is not the answer he is looking for. He wants to find the line in stdio.h where the fopen function is defined.
Frank Crook
That's not what he said. He asked, "*Can somebody please tell where can I find the definition?*"
Nathan Fellman
+1  A: 
extern FILE *fopen (__const char *__restrict __filename,
                    __const char *__restrict __modes) __wur;

As you said, in stdio.h.

Vivien Barousse
Where is `stdio.h` likely to be located?
Nathan Fellman
On UNIX systems, in `/usr/include`.
Vivien Barousse
A: 

alternatively, you can go on http://cplusplus.com/ under reference -> C Library -> cstdio (stdio.h)

w3b_wizzard
This is a reference for stdio.h, but it doesn't answer the question, 'where can I find the definition for fopen'. He's looking through source code, trying to find a line of code.
Frank Crook
+2  A: 

the declaration should be in stdio.h (afaik the standard requires this), but it's not likely you're going to find the definition there*. If you are using an open source os, it probably has packages containing source code (containing the definition) you can download. Else, sorry, no definition available.

*supposing the author considers definition to mean the actual implementation whereas declaration rather refers to function prototype

stijn
Even on Windows, the source code for the CRT is available if you have Visual Studio installed. For example, the source for `fopen` can be found in `C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\fopen.c`, or similar.
Phil Devaney
you're right, but I think you only get it if you buy VS, no? Or is it available with the Express versions as well?
stijn
A: 

I found sourcecode here. am not a C-Coder so check the result for yourself. As far as I can tell, it looks like a real implementation. But even if it is not the "true" implementation it can at least give some hinds for the learning eyes. So it should be helpful, to know this file.

erikb
+1  A: 

You can find the definitions of functions in stdio.h here: http://en.wikipedia.org/wiki/Stdio.h

And here's an article on C file io: http://en.wikipedia.org/wiki/C_file_input/output

plash
A: 

In C editter You can see Help Menu....than Index...write down fopen..u find whole explanation for fopen.. thank you

Parth
I'm sorry, but that just makes very little sense.
identity
In what editor?
Nathan Fellman