What's up guys! It's me again, I am going to borrow your brains again! Basically what I am trying to do is create a program or a script that will map a network (remote) Computer to a network printer.
Pseudo Structure:
printername = User Input
hostname = User Input
I want printer \\printerserver\printer to be mapped to computer \\computername.
'Assign' + printername + to computer' + hostname.
You know me I will link the whole source so you can have an idea of what I am trying to do.
Code:
#include <iostream>
#include <windows.h>
#include <string.h>
using namespace std;
static string hostname;
static string printername;
int main()
{
cout << "This is Auto Mapper \n";
cout << "Please Provide Target Hostname:";
cin >> hostname;
cout << "\nPlease Provide Printer Name:";
cin >> printername;
cout << "\nApplying Printer now..";
system("rundll32.exe printerui.dll,printUIEntry /in /c \\" + hostname + "/n \\44vprn01\"" + printername"");
return 0;
}
This is causing a compilation error pointing to an argument or how i'm initializing main(). Another thing which I will type out the output for you because I do not understand this..
expected ')' before string constant
cannot convert 'std::basic_string<char, std::char_traits<char>, std::allocator<char> >'to 'const char*' for argument '1' to 'int system(const char*)'
All of this code I did everything from head so I am pretty sure I am doing something wrong here. I did try to search for a function for mapping network printer and was unsuccessful. Any help would be most appreciated!