Hi All,
I am new with c and would like some help.
When reading a bin file the year is 06, the decimal value = 6 so I use the &rawtime to determine the year and then
cat it with the array (xya[j]) so that the result will printf 2006 and do this with the month as well as the day.
How can I strcat the "strncpy(datum,(char *)(ctime (&rawtime))+20,3);" (200) with the xya[j] array??????
Whenever I compile with gcc there are errors :
C.Fopen.c:170: warning: passing arg 2 of `strncat' makes pointer from integer without a cast
oC.Fopen.c:170: too few arguments to function `strncat'
What am I doing wrong or is there any other way to do this.
if(length < 10)
{
time (&rawtime);
if (xya[j]<10)
{
strncpy(datum,(char *)(ctime (&rawtime))+20,3);
datum[3]='\0';
}
else
{
strncpy(datum,(char *)(ctime (&rawtime))+20,2);
datum[2]='\0';
datum[3]='\0';
}
printf("XXXXX %s XXXXXX",datum);
strcat(datum,xya[j]);
// cat 200 with xya[j] (6) = 2006
}
//printf(" %d Len",length);
//printf("%x",xya[j]);
//printf(" Len %d ",length);
Many Thanks
Chris
I am new with c and would like some help.
When reading a bin file the year is 06, the decimal value = 6 so I use the &rawtime to determine the year and then
cat it with the array (xya[j]) so that the result will printf 2006 and do this with the month as well as the day.
How can I strcat the "strncpy(datum,(char *)(ctime (&rawtime))+20,3);" (200) with the xya[j] array??????
Whenever I compile with gcc there are errors :
C.Fopen.c:170: warning: passing arg 2 of `strncat' makes pointer from integer without a cast
oC.Fopen.c:170: too few arguments to function `strncat'
What am I doing wrong or is there any other way to do this.
if(length < 10)
{
time (&rawtime);
if (xya[j]<10)
{
strncpy(datum,(char *)(ctime (&rawtime))+20,3);
datum[3]='\0';
}
else
{
strncpy(datum,(char *)(ctime (&rawtime))+20,2);
datum[2]='\0';
datum[3]='\0';
}
printf("XXXXX %s XXXXXX",datum);
strcat(datum,xya[j]);
// cat 200 with xya[j] (6) = 2006
}
//printf(" %d Len",length);
//printf("%x",xya[j]);
//printf(" Len %d ",length);
Many Thanks
Chris