while((fgets(receiving array,50,file_ptr)!=EOF);

How this while is executed?

Recommended Answers

All 2 Replies

This is what my help files say about fgets return value...

char *fgets(char *s, int size, FILE *stream);

gets() and fgets() return s on success, and NULL on error or when end
of file occurs while no characters have been read.

>>How this while is executed?
Its an infinite loop because fgets() never returns EOF. fgets() returns NULL when it reaches end-of-file

commented: Exactly :) +8
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.