LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices

Reply
 
Search this Thread
Old 09-19-2002, 08:24 AM   #1
gmitra
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++


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.
 
Old 09-19-2002, 08:31 AM   #2
TheLinuxDuck
Member
 
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:
Code:
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, 08:57 AM   #3
gmitra
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
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.
 
  


Reply


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 6 03-21-2013 10:35 AM
what is "sticky bit mode" , "SUID" , "SGID" augustus123 Linux - General 10 08-03-2012 04:40 AM
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 11:26 AM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM
problem of "NaN" in redhat 7.3, with gcc-2.96 while running c_code mkh Programming 3 01-12-2004 01:17 AM


All times are GMT -5. The time now is 01:40 PM.

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