C Programming - Input / Output - Discussion
Discussion Forum : Input / Output - Point Out Errors (Q.No. 3)
3.
Point out the error in the program?
#include<stdio.h>
int main()
{
FILE *fp;
fp=fopen("trial", "r");
fseek(fp, "20", SEEK_SET);
fclose(fp);
return 0;
}
Answer: Option
Explanation:
Instead of "20" use 20L since fseek() need a long offset value.
Discussion:
13 comments Page 1 of 2.
Kunal said:
1 decade ago
What is the use of fseek() ?
Babita said:
1 decade ago
fseek()
It seeks a specified place within a file and modify it
It seeks a specified place within a file and modify it
Tanya said:
1 decade ago
What is seek_set() ?
Divya said:
1 decade ago
Is extension of the file "trial" necessary?
Prashant said:
1 decade ago
What is seek_set()? can anyone explain.
Ravi Sankar said:
10 years ago
seek_set = Cursor moves to first letter of the file .
seek_end = Cursor moves to last letter of the file.
seek_cur = Cursor starts when ever we accessed last world.
seek_end = Cursor moves to last letter of the file.
seek_cur = Cursor starts when ever we accessed last world.
Kirubashini said:
8 years ago
I don't understand this line:
fseek(fp, "20", SEEK_SET);
Please explain me.
fseek(fp, "20", SEEK_SET);
Please explain me.
MADHU said:
6 years ago
I can't understand. Please explain this program.
Pavani said:
6 years ago
What is mean by fseek?
Nitesh said:
6 years ago
Please explain the program.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers