Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Languages Misc > Re: Getting a p...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 13 Topic 1132 of 1193
Post > Topic >>

Re: Getting a programs cannonical path

by BruceMcF <agila61@[EMAIL PROTECTED] > Apr 16, 2008 at 04:46 PM

On Apr 16, 6:03 pm, "Aaron Gray" <ang.use...@[EMAIL PROTECTED]
> wrote:
> "BruceMcF" <agil...@[EMAIL PROTECTED]
> wrote in message

>
news:03b6d6f6-f06c-4e53-bd09-ec1af3ed7d1f@[EMAIL PROTECTED]
> > On Apr 15, 9:19 pm, "Aaron Gray" <ang.use...@[EMAIL PROTECTED]
> wrote:
> >> Ah, is there a function that searches the path for an executable and
> >> returns
> >> its path ?

> > Not a C Standard Library function ... that's outside the scope of the
> > standard. As I understand it, this is something that Unixen and
> > Windows handle differently. You may require a wrapper routine and an
> > OS specific definition of that wrapper routine to extract the
> > information.

> > This is, it turns out, a comp.lang.c FAQ:

> >http://www.faqs.org/faqs/C-faq/abridged/
> > QUOTE
> > 19.31: How can my program discover the complete pathname to the
> > executable from which it was invoked?

> > A: argv[0] may contain all or part of the pathname.  You may be
> > able to duplicate the command language interpreter's search path
> > logic to locate the executable.
> > UNQUOTE

> > In a system where argv[0] always contains the absolute pathname, the
> > wrapper would just parse argv[0].

> > In a system where argv[0] contains a filespec that might have been
> > used in combination with the path to find the file, then first check
> > if the argv[0] has an absolute path, and if not, try passing that
> > filespec to the path searching function. There normally will be a path
> > searching function in dir.h for, say, a Windows system, which can be
> > pressed into service.

> > ... argv[0] holding the absolute pathname and filename is, of course,
> > more secure, but the MS-DOS legacy includes a lot of stuff that is a
> > bit slapdash.

> Great, what an oversite :(
> Anyone got any code for this ?

I don't ... last time I was doing full on C programming, in the
mid-90's, it was all in PowerC from Mix, in DOS, for my own use, so I
was working in my own filesystem I had specified.

Maybe someone on comp.lang.c does? Follow-up reset to comp.lang.c
 




 13 Posts in Topic:
OT: Getting a programs cannonical path
"Aaron Gray" &l  2008-04-16 02:08:19 
Re: Getting a programs cannonical path
"Aaron Gray" &l  2008-04-16 02:19:53 
Re: Getting a programs cannonical path
BruceMcF <agila61@[EMA  2008-04-16 07:27:12 
Re: Getting a programs cannonical path
"Aaron Gray" &l  2008-04-16 23:03:50 
Re: Getting a programs cannonical path
Marco van de Voort <ma  2008-04-17 14:59:54 
Re: Getting a programs cannonical path
Marco van de Voort <ma  2008-04-21 16:02:20 
Re: Getting a programs cannonical path
BruceMcF <agila61@[EMA  2008-04-16 16:46:29 
Re: Getting a programs cannonical path
"Rod Pemberton"  2008-04-16 19:52:37 
Re: Getting a programs cannonical path
"Aaron Gray" &l  2008-04-17 01:22:40 
Re: Getting a programs cannonical path
"Rod Pemberton"  2008-04-17 02:59:45 
Re: Getting a programs cannonical path
"Aaron Gray" &l  2008-04-21 16:18:27 
Re: Getting a programs cannonical path
"Rod Pemberton"  2008-04-21 15:57:46 
Re: Getting a programs cannonical path
"Aaron Gray" &l  2008-04-22 11:52:45 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 5 22:56:16 CDT 2008.