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 :
http://www.lix.polytechnique.fr/~liberti/public/computing/prog/c/C/FUNCTIONS/fgets.html
http://www.codecogs.com/reference/computing/c/stdio.h/fgets.php

2 thoughts on “C/C++ declared with attribute warn_unused_result

  1. The Best Family Vacation Ideas – For Family Vocations…

    You got a really useful blog I compel ought to been here reading as a replacement for close to an hour. I am a newbie and your ascendancy is selfsame much an insight in the direction of me….

Leave a Reply to luxury holidays Cancel reply

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.