Getting system() to work?

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

  1. macrumors regular

    Joined:
    Jun 16, 2008
    #1
    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? All the warnings are in the first line.

    I have seen something about NStask however no code example and they are not explained in my books. Is that any better and would i have something like this?:

    Code:
    
    [NSTask "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"];
    
     
  2. macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    The backslash is the escape character. You have some backslashes that you want to appear literally in the first command. Just add a second backslash before each to escape them.

    -Lee
     
  3. macrumors 6502a

    Joined:
    Dec 4, 2006
    Location:
    Katy, Texas
    #3
    What exactly are the warnings?
     
  4. thread starter macrumors regular

    Joined:
    Jun 16, 2008
    #4
    got it
     

Share This Page