PDA

View Full Version : System() with a variable?




trey5498
Dec 16, 2011, 08:37 AM
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");



robbieduncan
Dec 16, 2011, 08:55 AM
How would you normally concatenate two or more strings?

trey5498
Dec 16, 2011, 10:03 AM
How would you normally concatenate two or more strings?

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

mfram
Dec 16, 2011, 10:11 AM
You can't do that without another variable in C. In languages like C++ or Java, you can.