Professional Web Applications Themes

running a Mach-O console program from a CFM app, capturing output? - Mac Programming

I have a CFM app and I want to run a Mach-O console program, passing it command-line arguments, and capture stderr/stdout to display in my CFM app. Is this doable? Any pointers?...

  1. #1

    Default running a Mach-O console program from a CFM app, capturing output?

    I have a CFM app and I want to run a Mach-O console program, passing it
    command-line arguments, and capture stderr/stdout to display in my CFM app.
    Is this doable? Any pointers?


    Paul Guest

  2. #2

    Default Re: running a Mach-O console program from a CFM app, capturing output?

    In article <com>,
    Paul Miller <com> wrote:
     

    I suppose you first try to do it from another MachO app. That would
    very likely involve either popen(), or (harder, but more powerful and
    doesn't freeze your app until it's done) exec() and fork().

    Once you have that working, use CFBundleGetFunctionPointerForName() to
    get function pointers to the MacOS X-native ANSI calls and call those
    from your CFM application.

    Since MacOS 9 doesn't have stdin, stdout, command-line arguments and
    the likes, CodeWarrior fakes all those for CFM apps using MSL
    ("Metrowerks Standard Library", fka "Modena Standard Library"). You have
    to load the real MachO calls using CFBundleBlahBlahBlah() since you
    can't mix-and-match MSL and MacOSX's BSD ANSI library.

    HTH,
    -- M. Uli Kusterer
    http://www.zathras.de
    Uli Guest

  3. #3

    Default Re: running a Mach-O console program from a CFM app, capturing output?

    >> I have a CFM app and I want to run a Mach-O console program, passing it 
    >
    > Since MacOS 9 doesn't have stdin, stdout, command-line arguments and
    >the likes, CodeWarrior fakes all those for CFM apps using MSL
    >("Metrowerks Standard Library", fka "Modena Standard Library"). You have
    >to load the real MachO calls using CFBundleBlahBlahBlah() since you
    >can't mix-and-match MSL and MacOSX's BSD ANSI library.[/ref]

    I figured as much, but was half-hoping for a Carbon "ExecuteProcess"-type
    function (silly me).

    Thanks for the pointers. I've done the Mach-O bundle garbage, so I can
    probably take it from here.


    Paul Guest

  4. #4

    Default Re: running a Mach-O console program from a CFM app, capturing output?

    In article <com>,
    Paul Miller <com> wrote:
     

    There is one (LaunchApplication), but it doesn't do anything about stdio. You
    need to fork and exec, so you'll have to load the symbols from System.framework
    manually.

    hth

    meeroh

    --
    If this message helped you, consider buying an item
    from my wish list: <http://web.meeroh.org/wishlist>

    Miro Guest

Similar Threads

  1. capturing control output
    By Jon Paal in forum ASP.NET Building Controls
    Replies: 0
    Last Post: March 6th, 07:59 PM
  2. Capturing text from console buffer ?
    By Anton in forum Linux Setup, Configuration & Administration
    Replies: 6
    Last Post: September 30th, 06:14 PM
  3. Capturing script output
    By Joel Konkle-Parker in forum PHP Development
    Replies: 0
    Last Post: August 21st, 04:17 PM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139