System() with a variable?

Discussion in 'Mac Programming' started by trey5498, Dec 16, 2011.

  1. macrumors regular

    #1
    If I ask for a user to enter a username (txtuser) ... BOB and then use that for a port how do I run the following?

    system("lpadmin -p printer -v ipp://server/txtuser -E -P /path to driver");
     
  2. Moderator

    robbieduncan

    Staff Member

    #2
    How would you normally concatenate two or more strings?
     
  3. macrumors regular

    #3
    I know how to do that. I was just wondering if there is an easier way to do it without creating another variable kinda like

    system("lpadmin -p printer -v ipp://server/" + txtuser + "-E -P /path to driver");

    or something
     
  4. macrumors 6502a

    #4
    You can't do that without another variable in C. In languages like C++ or Java, you can.
     

Share This Page