Is solution for control "NaN" and "Inf" in C/C++
Hi,
i have very easy question which your answer can solve big my problem. is there any solution how to control error outputs of function printf or fprintf in C/C++? Thx. With regards, Martin Gmitra. |
Are you refering to errors that occur from the use of printf or fprintf during runtime of an application? Or, are you refering to syntactic mistakes during the coding progress that result in errors during compilation? Or, to the actual output they provide during runtime from a legitimate call?
I can only assume for the moment that you're refering to the 3rd one. If you need the output to go to the standard error buffer, simply use fprintf as: Code:
fprintf(stderr, "Could not do that: %s\n", reasonString); |
Oh sorry, you are right. I misunderstand you. Here is
example: fprintf(f_out,"%e\n",log(-1.0)); produces output "Inf" because log function is defined for positive number without zero. In some reasons i have got "NaN". i want to get info during the runtime about this and regulate the output. Thx. Martin Gmitra. |
All times are GMT -5. The time now is 04:36 PM. |