hey everyone iv got a problem with the below source and I cant understand why it wont compile. When i try to compile it I get the following error:
105 runassrc.cpp incompatible types in assignment of `const char[11]' to `char[1000]'
Iv been messing about with it for hours but cant get it to work.
Any help is appreciated.
Code:// Runas Program Created by SuperStonerMan #include <stdio.h> #include <iostream> #include <cstring> #include <string.h> #include <cstdlib> #include <cstdio> void whichControl(int a); char control[1000]; int main() { using namespace std; //Variable decleration char userN[1000] = "administrator"; char command[1000] = "runas /user:"; int option = 0; // Intro and username input cout<<"This program was written by SuperStonerMan and allows a user\n"; cout<<"to efficentley use Windows Xp as a non admin user\n\n"; cout<<"Please enter the username you wish to open an applicationw with.\n"; cout<<"Username: "; cin>>userN; cin.ignore(); //Menu cout<<"\n"; cout<<"Which program would you like to open as " << userN << "\n"; cout<<"Option: 1 Explorer\n"; cout<<"Option: 2 Microsoft Mangment Console\n"; cout<<"Option: 3 Control Panel\n"; cout<<"Option: "; cin>>option; cin.ignore(); //Menu Logic if (option == 1) { cout<<"\n"; cout<<"Explorer\n"; strcat(command, userN); strcat(command, " \"explorer.exe /separate\""); system(command); } else if (option == 2) { cout<<"\n"; cout<<"Microsoft Mangment Console\n"; strcat(command, userN); strcat(command, " \"mmc /separate\""); system(command); } else if (option == 3) { int option1 = 0; cout<<"\n"; cout<<"Control Panel\n\n"; cout<<"Control Panel Menu\n"; cout<<"Option 1 Accessibility Options\n"; cout<<"Option 2 Add New Hardware\n"; cout<<"Option 3 Add/Remove Programs\n"; cout<<"Option 4 Date/Time Properties\n"; cout<<"Option 5 Display Properties\n"; cout<<"Option 6 Fonts Folder\n"; cout<<"Option 7 Internet Properties\n"; cout<<"Option 9 Keyboard Properties\n"; cout<<"Option 10 Windows Messaging\n"; cout<<"Option 11 Modem Properties\n"; cout<<"Option 12 Mouse Properties\n"; cout<<"Option 13 Multimedia Properties\n"; cout<<"Option 14 Network Properties\n"; cout<<"Option 15 Password Properties\n"; cout<<"Option 16 Printers Folder\n"; cout<<"Option 17 Regional Settings\n"; cout<<"Option 19 Sound Properties\n"; cout<<"Option 20 System Properties\n\n"; cout<<"Option: "; cin>>option1; cin.ignore(); whichControl(option1); cout<<"\n"; strcat(command, userN); strcat(command, " \"control "); strcat(command, control); //system(command); cout<<command; cin.get(); } } void whichControl(int a) { if (a == 1) { control = "access.cpl"; } }



LinkBack URL
About LinkBacks


