Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 09-19-2002, 09:24 AM   #1
LQ Newbie
Registered: Jun 2002
Location: Slovak Republic
Distribution: RedHat, Mandrake, Gentoo
Posts: 25

Rep: Reputation: 15
Unhappy Is solution for control "NaN" and "Inf" in C/C++

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++?
With regards,
Martin Gmitra.
Old 09-19-2002, 09:31 AM   #2
Registered: Sep 2002
Location: Tulsa, OK
Distribution: Slack, baby!
Posts: 349

Rep: Reputation: 33
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:
fprintf(stderr, "Could not do that: %s\n", reasonString);
If I am misunderstanding, please explain, and possibly post the section of code that is causing the problem.
Old 09-19-2002, 09:57 AM   #3
LQ Newbie
Registered: Jun 2002
Location: Slovak Republic
Distribution: RedHat, Mandrake, Gentoo
Posts: 25

Original Poster
Rep: Reputation: 15
Oh sorry, you are right. I misunderstand you. Here is


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.
Martin Gmitra.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
bash script: using "select" to show multi-word options? (like "option 1"/"o zidane_tribal Programming 7 12-19-2015 02:03 AM
what is "sticky bit mode" , "SUID" , "SGID" augustus123 Linux - General 10 08-03-2012 05:40 AM
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 12:26 PM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 04:07 PM
problem of "NaN" in redhat 7.3, with gcc-2.96 while running c_code mkh Programming 3 01-12-2004 02:17 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:40 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration