C/C++ declared with attribute warn_unused_result

I want to read a text file with C. This is my simple ilustration code :

When I compile this code I get warning message :

ignoring return value of ‘fgets’, declared with attribute warn_unused_result

This is because functions fgets returning char. To solve this problem, I change my code with :

Source :

Add a Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.