Ciao a tutti!!
Ho un problema con un programma..
codice:
#include <iostream>
#include <fstream>
using namespace std;
/*
*
*/
int main(int argc, char** argv) {
// Inizializzo le variabili...
int cordX,cordY,i,udt,sp;
char IP[50]= "";
char SN[50]= "";
char WT[250]= "";
char Nut[20]= "";
char SH[16]= "";
char TS[21]= "";
char PRT[9]= "";
char FM[10]= "";
char tf[7]= "";
char sn,fw,sc;
// Chiedo i vari dati per il server...
cout << "Specifica le coordinate del server:" << endl;
cout << "X:";
cin >> cordX;
cout << "Y:";
cin >> cordY;
cout << "" << endl;
cout << "Inserisci l'IP del server:" << endl;
cin >> IP;
cout << "Inserisci il nome del server:" << endl;
cin >> SN;
cout << "Inserisci un testo di benvenuto per il server:" << endl;
cin >> WT;
cout << "Vuoi abilitare il Server Hiding?(s/n)" << endl;
cin >> sc;
if(sc == 's'){
SH = "\"\"";
} else {
SH = "\"File Server\"";
}
cout << "" << endl;
cout << "Scegli il Terminal Server che desideri:" << endl;
cout << "--1) No Interfaccia" << endl;
cout << "--2) File Server" << endl;
cout << "--3) Mail Server" << endl;
cout << "--4) News Server" << endl;
cout << "--5) Subscription Server" << endl;
cout << "--6) Software Server" << endl;
cout << "--7) Netbanking Server" << endl;
cout << "--8) Commerce Server" << endl;
cout << "--9) Database Server" << endl;
cin >> udt;
switch(udt){
case 1:
TS = "-1";
break;
case 2:
TS = "FileServer";
break;
case 3:
TS = "MailServer";
break;
case 4:
TS = "NewsServer";
break;
case 5:
TS = "SubscriptionServer";
break;
case 6:
TS = "SoftwareServer";
break;
case 7:
TS = "NetbankingServer";
break;
case 8:
TS = "CommerceServer";
break;
case 9:
TS = "DatabaseServer";
break;
default:
TS = "-1";
break;
}
cout << "" << endl;
cout << "Scegli il tipo di protezione che vuoi adottare per il tuo server:" << endl;
cout << "--1) No Protezione" << endl;
cout << "--2) Login" << endl;
cout << "--3) Key File" << endl;
cout << "--4) VRLS" << endl;
cin >> sp;
switch(sp){
case 1:
PRT = "-1";
break;
case 2:
PRT = "Login";
break;
case 3:
PRT = "KeyFile";
break;
case 4:
PRT = "VRLS";
break;
default:
PRT = "-1";
break;
}
cout << "" << endl;
cout << "Vuoi abilitare il Firewall?(s/n)" << endl;
cin >> fw;
if(fw = 's'){
tf = "true";
cout << "Inserisci l'IP del Firewall:" << endl;
cin >> FM;
} else {
tf = "false";
FM = "*.*.*.*";
}
// Ricapitolo i adti immessi durante la creazione del server...
cout << "" << endl;
cout << "I dati immessi sono: " << endl;
cout << "Coordinate X: " << cordX << endl;
cout << "Coordinate Y: " << cordY << endl;
cout << "IP del server: " << IP << endl;
cout << "Nome del server: " << SN << endl;
cout << "Testo di benvenuto: " << WT << endl;
cout << "Tipo del server: " << SH << endl;
cout << "Terminal Interface: " << TS << endl;
cout << "Protezione: " << PRT << endl;
cout << "Firewall: " << tf << endl;
cout << "I dati inseriti sono corretti?(s/n)" << endl;
cin >> sn;
if(sn == 's'){
ofstream f("00.00.00.00.svr");// Creo il file con nome l'IP del server...
if(!f){
cout << "Errore nel creare il file!" << endl;
return -1;
}
// Scrivo nel file...
f << "/* ***********************************************************************************************" << endl;
f << " File di definizione Server generato automaticamente da 'ServerMaker' [Mother's EditTools] " << endl;
f << "*********************************************************************************************** */" << endl;
f << "" << endl;
f << "// Configurazione principale del Server..." << endl;
f << "MapX=" << cordX << endl;
f << "MapY=" << cordY << endl;
f << "ServerName=\"" << SN << "\"" << endl;
f << "IP=\"" << IP << "\"" << endl;
f << "WelcomeText=\"" << WT << "\"" << endl;
f << "ServerType=" << SH << endl;
f << "TerminalInterface=" << TS << endl;
f << "Background=-1" << endl;
f << "" << endl;
f << "// Sistemi di protezione..." << endl;
f << "Protection=" << PRT << endl;
f << "Firewall=" << tf << endl;
f << "FirewallMask=" << FM << endl;
f << "" << endl;
// Chiudo il file in scrittura...
f.close();
cout << "Scrittura avvenuta con successo!" << endl;
return 0;
} else {
return -1;
}
}
che mi restituisce questi errori...
codice:
main.cpp:45: error: incompatible types in assignment of ‘const char [3]’ to ‘char [16]’
main.cpp:47: error: incompatible types in assignment of ‘const char [14]’ to ‘char [16]’
main.cpp:63: error: incompatible types in assignment of ‘const char [3]’ to ‘char [21]’
main.cpp:66: error: incompatible types in assignment of ‘const char [11]’ to ‘char [21]’
main.cpp:69: error: incompatible types in assignment of ‘const char [11]’ to ‘char [21]’
main.cpp:72: error: incompatible types in assignment of ‘const char [11]’ to ‘char [21]’
main.cpp:75: error: incompatible types in assignment of ‘const char [19]’ to ‘char [21]’
main.cpp:78: error: incompatible types in assignment of ‘const char [15]’ to ‘char [21]’
main.cpp:81: error: incompatible types in assignment of ‘const char [17]’ to ‘char [21]’
main.cpp:84: error: incompatible types in assignment of ‘const char [15]’ to ‘char [21]’
main.cpp:87: error: incompatible types in assignment of ‘const char [15]’ to ‘char [21]’
main.cpp:90: error: incompatible types in assignment of ‘const char [3]’ to ‘char [21]’
main.cpp:102: error: incompatible types in assignment of ‘const char [3]’ to ‘char [9]’
main.cpp:105: error: incompatible types in assignment of ‘const char [6]’ to ‘char [9]’
main.cpp:108: error: incompatible types in assignment of ‘const char [8]’ to ‘char [9]’
main.cpp:111: error: incompatible types in assignment of ‘const char [5]’ to ‘char [9]’
main.cpp:114: error: incompatible types in assignment of ‘const char [3]’ to ‘char [9]’
main.cpp:121: error: incompatible types in assignment of ‘const char [5]’ to ‘char [7]’
main.cpp:125: error: incompatible types in assignment of ‘const char [6]’ to ‘char [7]’
main.cpp:126: error: incompatible types in assignment of ‘const char [8]’ to ‘char [10]’
come risolvo?? Non riesco proprio a capire!!
grazie a tutti quelli che mi aiuteranno!!