K
kaizen
Hi,
i wrote the code in C and compiled in VC++ compiler. at that time it
has thrown the below mentioned error.
error C2664: 'strcpy' : cannot convert parameter 2 from 'char' to
'const char *'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
Herewith i have added the code also.
-----------------------------------
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
char message[15]=":80a1:SSBKRO";
char *location;
char* receiver='\0';
char* rec='\0';
int i,j,cnt=0;
int mt511=(int) strlen(":80a1:");
printf("%s\n",message);
if((location=strstr(message,":80a1:")) != NULL)
{
for(i=0;i<mt511;i++)
location++;
for(j=mt511;j<mt511+8;j++)
while(*location!='\0')
{ strcpy(rec,message[j]);
strcat(receiver,rec);
cnt++;
}
/*for(i=0;i<mt511;i++)
location++;
strncpy(receiver,location,cnt);*/
}
else
{
for(i=mt511;i<cnt;i++)
{
strcpy(rec,"X");
strcat(receiver,rec);
}
}
printf("%s\n",receiver);
return 0;
}
----------------------------------------
Kindly help me to resolve this issue. Thanks In advance.
Regards,
kaizen
i wrote the code in C and compiled in VC++ compiler. at that time it
has thrown the below mentioned error.
error C2664: 'strcpy' : cannot convert parameter 2 from 'char' to
'const char *'
Conversion from integral type to pointer type requires
reinterpret_cast, C-style cast or function-style cast
Herewith i have added the code also.
-----------------------------------
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
char message[15]=":80a1:SSBKRO";
char *location;
char* receiver='\0';
char* rec='\0';
int i,j,cnt=0;
int mt511=(int) strlen(":80a1:");
printf("%s\n",message);
if((location=strstr(message,":80a1:")) != NULL)
{
for(i=0;i<mt511;i++)
location++;
for(j=mt511;j<mt511+8;j++)
while(*location!='\0')
{ strcpy(rec,message[j]);
strcat(receiver,rec);
cnt++;
}
/*for(i=0;i<mt511;i++)
location++;
strncpy(receiver,location,cnt);*/
}
else
{
for(i=mt511;i<cnt;i++)
{
strcpy(rec,"X");
strcat(receiver,rec);
}
}
printf("%s\n",receiver);
return 0;
}
----------------------------------------
Kindly help me to resolve this issue. Thanks In advance.
Regards,
kaizen