Command Advice help (Just the names)

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

  1. macrumors regular

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

    lee1210

    Joined:
    Jan 10, 2005
    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. thread starter macrumors regular

    Joined:
    Jun 16, 2008
    #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
    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 emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    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. thread starter macrumors regular

    Joined:
    Jun 16, 2008
    #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