• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: help with calling a standard line app from terminal
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help with calling a standard line app from terminal


  • Subject: Re: help with calling a standard line app from terminal
  • From: "Clark Cox" <email@hidden>
  • Date: Tue, 2 Sep 2008 19:48:03 -0700

On Tue, Sep 2, 2008 at 5:31 PM, Michael <email@hidden> wrote:
> Hi all,
> I am working my way through K&R, getting ever closer to obj C, and in
> section 7, wrote a small app , in the standard tool called  "upper".
>
> So, 2 questions please.
>
> 1) What is passed to argv[0]?  is it just "upper" or the full path to the
> app, and if so, how does one determine this?

It is whatever was used to launch your program. If the user launched
it with the full path, then you will get the full path, if the user
launched it with a relative path, you will get that. another program
could pass anything that they want when launching your program (even a
string that is totally unrelated to your application)

What do you need to know this for?

> 2) How to call this app from the  terminal...I am guessing the full path,
> but nothing I have tried has worked so far.

If you put your program in a directory that is in your $PATH
environment variable, you can launch it with just a name. Otherwise,
you can use any kind of path (full, relative) as long as it refers to
your program's location in the filesystem.

--
Clark S. Cox III
email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: help with calling a standard line app from terminal
      • From: Michael <email@hidden>
References: 
 >help with calling a standard line app from terminal (From: Michael <email@hidden>)

  • Prev by Date: Re: Getting the size of type in the preprocessor.
  • Next by Date: Re: help with calling a standard line app from terminal
  • Previous by thread: help with calling a standard line app from terminal
  • Next by thread: Re: help with calling a standard line app from terminal
  • Index(es):
    • Date
    • Thread