LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 11-20-2004, 03:41 PM   #1
george_mercury
LQ Newbie
 
Registered: Jun 2004
Location: Slovenia
Distribution: Gentoo
Posts: 27

Rep: Reputation: 15
Error reporting in c


Hi guys!
Im writing my first command line program used for communicating with a device on serial port. The program takes options on communication speed from command line or from a configuration file. Command line options override the ones in config file. I have one function which is used to check if the specified com speed is valid; this function is called by command line parsig and config file parsing functions. If the speed is invalid it prints "Error: invalid baud rate specified\n". But this sucks, because the user won't know, where the error came from: eather from cmd line or from config file. The problem is that the function doesn't know from where was it called, so it doesn't know the source of the error. So how do you guys usually handle these kind for error messages?

Best regards
George
 
Old 11-20-2004, 05:27 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
I use extra parameters passed to functions that need to know more, then the right error message can be build.
 
Old 11-20-2004, 06:22 PM   #3
itsme86
Senior Member
 
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
Me too. It's about all you can do.
 
  


Reply



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
df reporting incorrectly bigtl Linux - General 2 06-23-2005 05:47 AM
Reporting bugs in 10.1? RedDwarf Mandriva 1 02-01-2005 10:34 AM
mail log reporting error every minute kwingate Fedora 0 10-25-2004 09:07 PM
Reporting IP adress eclapton1 Programming 1 06-27-2004 11:34 PM
sshd reporting antken Linux - Networking 8 06-08-2003 10:13 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:28 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration