0 like 0 dislike
28 views
in Computer Science by (1.0m points)
What is file pointer?

1 Answer

0 like 0 dislike
by (1.0m points)
I am trying to understand what does file pointer increment means .

I have declared file pointer fp and assuming that when I use fopen for any file (say test99.txt) and try to read it then compiler dynamically allocate memory ( in heap ofcourse because I think internally fopen make use of malloc in order to put file in main memory) and once file stream/data of file is put in memory then I am assuming fp contains the start address of that file stream. Now incrementing fp by 1 (++fp) which is pointer of type FILE will increase/hop the position of fp by total size of data/stream inside that file test99.txt. If not, and let's say incrementing fp will move fp pointer to the next character (1 byte) within the file stream then why is the below output ? ( why fp moved by 16 bytes:see the diff) Where am I misunderstanding .
Welcome to Free Homework Help, where you can ask questions and receive answers from other members of the community. Anybody can ask a question. Anybody can answer. The best answers are voted up and rise to the top. Join them; it only takes a minute: School, College, University, Academy Free Homework Help

19.4k questions

18.3k answers

8.7k comments

3.2k users

Free Hit Counters
...