On Sunday 04 January 2004 13:02, Craig McLean wrote:
> I've been doing some more C coding lately, and have some questions.
>
> First is there any standardized way of parsing command line inputs to a C
> program.  I rummaged around the C standard looking for some magic library
> that makes command line input parsing not suck, but there isn't anything.
> Is there some well used external library I can grab and use to ease command
> line input parsing in C programs?
>

As Dave mentioned ... using getopt, and actually getopt_long is meant for 
command line parsing.  Read the man page for getopt_long.  I'll also send you 
some example code.  

FYI ... its the main.cc file for the Olympus server.  Although Olympus was C++ 
the same methodology applies.  If you have questions feel free.

> Second why is signal.h and signal handling in general part of the C
> standard?  C is a generic platform independent language.  It is surprising
> to me that something as UNIX specific as signals is part of ANSI C.  Is the
> notion of signals more widespread then I thought, or is this just a
> historical artifact related to C's heritage as the UNIX systems programming
> language?
>

C is not platform independent!

Can you compile a UNIX written C program on Windows?  I'd bet no, for a 
complex program.  A "hello world" program ... possibly. ;-)

There are signals defined within the POSIX (PASC) standard, and should 
therefore be supported by windows, and other operating systems.  That's why 
if you are writing code using signal processing, it all depends on which 
platform you are on.  You would net to get familiar with the signal 
implementation used, and what APIs you have within your development 
environment.

It's like socket programming.  (*shudder*)

Andy



_______________________________________________
clug-talk mailing list
[EMAIL PROTECTED]
http://clug.ca/mailman/listinfo/clug-talk_clug.ca

Reply via email to