Hi everyone! Im new in this forum!
Im having problems with the funtion "strcpy"
I used it to copy what the char var "sex" have to the char var "nuevo->sexo", both are char of 1 byte, so i dont know the reason of this error:
Help will be really apreciate since is a proyect for tomorrow, is the unique wierd error that im having and i dont know how to solved it.
Here the funtion and my header:
The error obtained when i try compile is:Code://HeaderBegin #include <stdio.h> #include <stdlib.h> #include<iostream> #include<conio.h> #include<fstream> #include<ctime> #include <string.h> #include <stdlib.h> #include <windows.h> using namespace std; //int cl=0; // odio esta variable long sesion=0; // pronto morira la variable de arriba, muahahahaha! char n[50],a[50]; struct tfecha{ int dd; int mm; int aa; }; time_t tSac = time(NULL); // instante actual struct tm* tmP = localtime(&tSac); // time /* hoy.dd= tmP->tm_mday; hoy.mm= tmP->tm_mon+1; hoy.aa= tmP->tm_year+1900; */ struct cliente{ // Nota importante: cada ves que sea cambiada esta structura debe borrase la base de datos long cedula; // int admin; int deleted; int pin; char nombre[50]; char apellido[50]; char sexo; double capital; tfecha fapertura; cliente *sig; }client,verifc, *nuevo, *lista=NULL, *aux,*ant,*aux1; struct administrador{ // Nota importante: cada ves que sea cambiada esta structura debe borrase la base de datos int cedula; // int admin; // int deleted; int pin; // char nombre[50]; // char apellido[50]; // char sexo; // double capital; tfecha fapertura; administrador *sig; }admin, *nuevoa, *listaa=NULL, *auxa, *anta, *aux1a; void wait(long seconds) { seconds = seconds * 1000; Sleep(seconds); } // HeaderEnd void NuevaCuenta() { int errur,errer; char ci[8],cap[9],pp[4]; char nomb[50], apell[50], sex; int k=0; int c; int ex=0,edor=0; // fecha time_t tSac = time(NULL); // instante actual struct tm* tmP = localtime(&tSac); // time //fechda end edor=0; // vadiable pada chequead pod errores, la variable es util y funcional // ofstream archo; // ofstream archi; /* archo.open("bancodata.db",ios::app); archo.write((char*)& client,sizeof(client)); archo.close(); */ //archi.open("bancodata.db",ios::app); //archi.open("bancodata.db",ios::app|ios::in|ios::out); // archi.open("bancodata.db",ios::in|ios::out); archi.open("bancodata.db",ios::app); nuevo= new cliente; ex=0; c=0; do{ edor++; system("cls"); cout<<"\n\t-------------------------------------------------------------"; cout<<"\n\t- BANCO MANDANTE -\n\n\t> APERTURA DE UNA CUENTA\n\n\tPorfavor ingrese los datos requeridos para apertura su cuenta:"; cout<<"\n\t-------------------------------------------------------------"; cout<<"\n\tFecha de hoy: "<<tmP->tm_mday<<" / "<<tmP->tm_mon+1<<" / "<<tmP->tm_year+1900; if(edor>1) { cout<<"\n\n\t[!] Error: Ya existe un usuario con la cedula indicada o\n\tah ingresado una cedula invalida."; } cout<<"\n\n\t]Digite su cedula: \t\t"; cin>>ci; c=atoi (ci); // disponible begin if (c!=0) ex=Disponible(c); else ex=0; //if(c==0) ex=0; // linea de mas?? no me crees? revisa lo de arriba, ves? no ves? CIEGO! // disponible end }while(ex==0); //client.cedula=c; nuevo->cedula=c; // cout<<c; cout<<"\n\t]Su nombre: \t\t"; // cin>>client.nombre; cin>>nomb; //nuevo->nombre=nomb; strcpy (nuevo->nombre,nomb); cout<<"\n\t]Su Apellido: \t\t"; //cin>>client.apellido; cin>>apell; //nuevo->apellido=apell; strcpy (nuevo->apellido,apell); cout<<"\n\t]Sexo (F)emenino/(M)asculino: \t\t"; //cin>>client.sexo; cin>>sex; //nuevo->sexo=sex; strcpy (nuevo->sexo, sex); // Line of the error errer=0; do{ if (errer>0) cout<<"\n\t [!] Error: Monto ingresado es invalido"; cout<<"\n\t]Monto de Apertura(BSF VEF): \t\t"; //cin>>client.capital; cin>>cap; //client.capital = atoi (cap); nuevo->capital= atoi (cap); if(nuevo->capital==0) errer++; }while(nuevo->capital==0); errur=0; do{ if (errur>0) cout<<"\n\t [!] Error: pin ingresado incorrectamente."; cout<<"\n\tIngrese el pin que usara para ingresar al sistema(4 digitos NUMERICOS)\n\t]Pin: \t\t"; //cin>>client.pin; cin>>pp; //client.pin = atoi (pp); nuevo->pin = atoi (pp); if (nuevo->pin==0) errur++; }while(nuevo->pin==0); //client.admin=1; // 1 = usuario, 2 = administrador // client.deleted=0; // cliente no borrado nuevo->deleted=0; system("cls"); cout<<"\n\n\tSu cuenta ah sido registrado exitosamente!\n\n\tRegresando al Menu Principal..."; nuevo->fapertura.dd=tmP->tm_mday; // posible problema nuevo->fapertura.mm=tmP->tm_mon+1; nuevo->fapertura.aa=tmP->tm_year+1900; // archi.write((char*)& client,sizeof(client)); // archi.close(); getch(); // cl++; }
In function `void NuevaCuenta()':
invalid conversion from `char' to `char*'
initializing argument 1 of `char* strcpy(char*, const char*)'
`char' to `const char*'
initializing argument 2 of `char* strcpy(char*, const char*)'
Others details: Im using the compiler Dev C/C++
PD: Sorry if my english isnt good.



LinkBack URL
About LinkBacks


