Command Advice help (Just the names)

Discussion in 'Mac Programming' started by trey5498, Jun 25, 2008.

  1. trey5498 macrumors regular

    Jun 16, 2008
  2. lee1210 macrumors 68040


    Jan 10, 2005
    Dallas, TX
    For something that specific I would probably just use system() to either call those directly or call a shell script that you package with your app to do those things. Others may chime in with API calls to handle that, but I'm not sure if they exist or not.

  3. trey5498 thread starter macrumors regular

    Jun 16, 2008
    I was afraid of that as I know to many outside calls can slow a program down.
  4. lazydog macrumors 6502a

    Sep 3, 2005
    Cramlington, UK
    If passing commands to the shell means you can get your tool/app done sooner and with less problems or bugs then I would say go for it. It might not be the prettiest way but so what. I doubt it will slow your app down noticeably and speed for these sort of tools is subjective anyway.

    b e n
  5. robbieduncan Moderator emeritus


    Jul 24, 2002
    There are not Cocoa wrappers to all system/command line functionality. System calling will be fine: it's really not all that expensive at all.
  6. trey5498 thread starter macrumors regular

    Jun 16, 2008
    system("lpadmin -p ARC-ATLAB-BWQ -v lpd:// -P /Library/Printers/PPDs/Contents/Resources/HP\ LaserJet\ 4250.gz");
    system("cupsenable ARC-ATLAB-BWQ");
    system("accept ARC-ATLAB-BWQ");
    seems to throw warnings out is there a char that I put in it (IE: Perl has the "\" to make chars that that mean something in it act literally) to make it behave correctly?

    and can I call a method or function fro a .sh file the same way I would a .m file?

Share This Page