#include <stdio.h>
#include<conio.h>
#include<string>
#include<iostream>
using namespace std; 
int main()
{
    string aa ,bb;
                  
    aa="mycomp"; //Comp name
    bb="User1"; //User name
         
     string r_parameter=" -l ";
     string r_parameter1=" -n ";
     string r_exe="ipconfig";
     aa.append(r_parameter);
     aa.append(bb);
     aa.append(r_parameter1);
     aa.append(r_exe);
     
     cout<<"\nHello\n";
     cout << aa << endl;
     system(" Rsh aa");
     getch();
  
}

problem is execution at here ---system(" Rsh aa");
but when run system (" Rsh mycomp -l User1-n ipconfig"); it works...
how to resolve this problem??

you're just executing "Rsh aa" ( system("Rsh aa"); ) which isn't a command.
To use a string with the system command, do something like:

int main()
{

    string command = "Rsh";

    string param1 = " -l";
    string param2 = " -n"; 
    //etc
    //etc
    string commandline = command + param1 + param2;
    cout << commandline << "\n";
    system(commandline.c_str());
    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.