Outline ·
[ Standard ] ·
Linear+
C programming Help
TSxboxrockers
|
Jul 19 2016, 10:06 PM, updated 8y ago
|
|
Hi I am 16 , I am learning C and writing code on c language for past 6-8 months
[
#include<stdio.h>
void main ()
{
FILE* fp; char ch;
fp=fopen("text.txt", "r"); do { ch=getc(fp); printf("%c",ch);
}
]
I know that *fp is a kind of pointer to store memory location , But what is the FILE in front the is doing , what they call the FILE
because i never come across it , i use pointer in this form , jus as Example : int *p1 = &MemoryLocationOfVariableReferring
I want to know what does The FILE is doing infront pointer fp , Is it something to do with library ? I hope I will get a answer and people can understand what is my question
This post has been edited by xboxrockers: Jul 19 2016, 10:09 PM
|
|
|
|
Eventless
|
Jul 19 2016, 11:20 PM
|
|
|
|
|
|
TheSolver
|
Jul 23 2016, 10:48 AM
|
|
QUOTE(xboxrockers @ Jul 19 2016, 10:06 PM) Hi I am 16 , I am learning C and writing code on c language for past 6-8 months [ #include<stdio.h> void main () { FILE* fp; char ch; fp=fopen("text.txt", "r"); do { ch=getc(fp); printf("%c",ch); } ] I know that *fp is a kind of pointer to store memory location , But what is the FILE in front the is doing , what they call the FILE because i never come across it , i use pointer in this form , jus as Example : int *p1 = &MemoryLocationOfVariableReferring I want to know what does The FILE is doing infront pointer fp , Is it something to do with library ? I hope I will get a answer and people can understand what is my question C doesn't require you to understand what FILE is and if you're really want to understand it, constrain your desire under control because it is no good for your study of the C Language. It's part of the standard input output system library. And all you need is to manipulate its pointer to achieve your purpose. And it can as well be a macro for what the compiler cares, and your assumption it is a pointer to some memory location etc is not necessarily true, semantically.
|
|
|
|