Hi,
I am using visual studio 2010. Im creating a program and i was wondering if it is possible to input a variable in with the system command for example user inputs a ip under a string variable how would i combine that in with the system command? would it be like this? Can i get an example of how to do it please?
It's a really simple topic, really. Just look it up. You have the choice of using C strings, or the C++ std::string class. The latter is easier. You can check the reference in this site for detailed information about this C++ class.
If you decide to go the route of C strings, you can just use the C string functions found in the <cstring> header, such as strlen() to get the length of a string, or strcpy() to copy one string into another, or strcat() to concatenate two strings. Here's a very simple example with C strings (untested):
I gave you the key components. I usually don't give out complete solutions. You should be able to extrapolate my example to your particular needs, or investigate about std::string. Either way it is very simple.
Too much copy'n'paste and not enough reading comprehension,
1 2
if (x=1) goto ping; // == tests equivalence, = assigns a value.
if (x=2) goto netview;
1 2 3
cin>>ip; //input ip
str<<"ping "<<x; // ???
system( str.str().c_str() );
goto and system() are evil.. and you're going to burn in hell.
http://www.cplusplus.com/doc/tutorial/control/
http://msdn.microsoft.com/en-us/library/ms682425
system is even more evil than goto. There are, under some very, very rare circumstances situations in which using goto might be a somewhat understandable idea. system is pretty much never useful.