PDA

View Full Version : Getting system() to work?




trey5498
Jun 27, 2008, 12:15 PM
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?:



[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"];



lee1210
Jun 27, 2008, 12:42 PM
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

toddburch
Jun 27, 2008, 12:44 PM
What exactly are the warnings?

trey5498
Jun 27, 2008, 01:04 PM
got it