|
-
December 29th, 2003, 09:02 PM
#11
Senior Member
fp=fopen("test","r");
fp is a pointer which cntains the address of the structure FILE which has been defined in the header file "stdio.h"
fopen() will open the file "test" in read mode which tells the C compiler that we would be reading the contents of the file. 'r' is a file opening mode
once the file has been opened for reading using fopen() the file's contents are brought into the main memory and a pointer to the first character. to read the fole's contents from the memory there is the function "fgetc()"
ch=fgets(fp);
fgets() reads the character from current pointer position, advances to the next character and reads it, which we have collected in the variable "ch". "fp" is the file pointer.
rest of it i think u could easily understand
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|