I am new to c++.
I want to ignore warning -Wunused-result
which I guess popped because of -Wall
flag.
I did search on net and found that this is I can ignore it by declaring a pragma
. I don't have much knowledge about pragma
but it says that I have to write warning number
in order to ignore it.
What is warning number
of -Wunused-result
, or is there any other way I can ignore or disable this specific warning?
code:-
freopen("input", "r", stdin);
freopen("output", "a", stdout);
on compiling:-
warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’, declared with attribute warn_unused_result [-Wunused-result]
I found that I need to declare something like
#pragma warning( disable : number_of_warning )