Command Advice help (Just the names)

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

  1. macrumors regular

    Joined:
    Jun 16, 2008
    Messages:
    191
    #1
  2. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Messages:
    3,172
    Location:
    Dallas, TX
    #2
    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.

    -Lee
     
  3. macrumors regular

    Joined:
    Jun 16, 2008
    Messages:
    191
    #3
    I was afraid of that as I know to many outside calls can slow a program down.
     
  4. macrumors 6502a

    Joined:
    Sep 3, 2005
    Messages:
    686
    Location:
    Cramlington, UK
    #4
    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. Moderator

    robbieduncan

    Staff Member

    Joined:
    Jul 24, 2002
    Messages:
    24,480
    Location:
    London
    #5
    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. macrumors regular

    Joined:
    Jun 16, 2008
    Messages:
    191
    #6
    Code:
    system("lpadmin -p ARC-ATLAB-BWQ -v lpd://at-regulus.ad.ufl.edu/ARC-ATLAB-BWQ -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