Results 1 to 4 of 4
  1. #1
    sharada
    Guest
    invoking an application with in another application
    Hai ,
    i am new to mac.i donot know how to do the things here .

    i want to create two applications , i.e. app1 and app2.

    All app1 does is invokes app2 if not started. Sleeps for some time (i.e. 60 sec). Then exits.
    App1 basically invokes app2 the very first time it is run. Next instance of App1 simply checks to see if App2 is running. If so, prints a message like App2 is already running. So both App1 instances will essentially communicate with App

    When one instance of App1 exits, we do not shutdown App2 (since other instance of App1 can still be talking to it).

    When second instance of App1 exits (last instance of App1), it shuts down App2 and then exits.i want to write these two applications in "C".


    please help me regarding this , if possible send me some code samples.

    Thanks & Regards,
    sharada..

  2. #2

    rman's Avatar
    Member Since
    Dec 24, 2002
    Location
    Los Angeles, California
    Posts
    12,584
    Specs:
    2 x 3.0GHz Quad-Core, 6GB OS X 10.6.8 | 15in MacBook Pro 2.2GHz OS X 10.6.8 | 64GB iPad 2 WiFi
    Cool
    It appears to me, that you want a shell script call app1 and a C application called app2. The shell script app1 will have a loop and a if then statement of sort. It will then check to see if app2 is running if not it start it, and then go to sleep for a short period of time. Upon waking it will check for app2, and repeat the cycle. I don't see app1 communicating with app2, just checking to see if it is up. We would need more to get a feel for what you are trying to do.
    Life isn't about waiting for the storm to pass, It's about learning to dance in the rain!

  3. #3
    sharada
    Guest
    invoking an application with in another application
    hai ,
    thanks for response ,i donot want to use shell script. first of all i need to run one application sum with in other application Launcher(like create process in windows), Launcher invokes sum if not started. Sleeps for some time (i.e. 60 sec). Then exits.
    Launcher basically invokes sum the very first time it is run. Next instance of Launcher simply checks to see if sum is running. If so, print a message like sum is already running. So both Launcher instances will essentially communicate with sum.i need to do the code in pure c. ( nothing but "C") first please ,guide me to this things first.

    Thanks & Regards,
    sharada..

  4. #4

    cazabam's Avatar
    Member Since
    Jun 06, 2006
    Posts
    1,153
    Specs:
    MacBook 2.0GHz White, 512MB RAM, 60GB HDD
    There are many ways to do this, ranging from the simplistic to the insanely complex. From a terminal, type:

    man 3 exec

    That will detail how to launch programs from within a C program. Also look at:

    man 3 fork

    for splitting off new processes.

    As for checking if it's already running, you could do it with a simple lock file in the user's home directory, or something complex involving semaphores, signals, shared memory or any number of other IPC mechanisms. It's quite a complex subject; searching the web for 'unix ipc' will give you many pointers.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 3
    Last Post: 03-22-2014, 08:30 PM
  2. Unable to move application to application folder
    By kcmn101 in forum OS X - Apps and Games
    Replies: 6
    Last Post: 11-22-2012, 02:34 PM
  3. Searching for an Application/Window Profiling Application
    By AwesomeAttorney in forum OS X - Apps and Games
    Replies: 0
    Last Post: 08-30-2012, 10:10 PM
  4. Application Maintenance from Dock and Application Folder
    By ZoSo0789 in forum Switcher Hangout
    Replies: 2
    Last Post: 08-05-2010, 08:07 AM
  5. Replies: 0
    Last Post: 02-10-2009, 08:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •