hi all, i hope u guys can help me, i had a little experience in C but just in math stuff, now i need to handle string but i cant figure it out, i check the forum but i didnt find what im looking for, i now how to create "strings" in C, the problem is when i want to concatenate strings or handle more than one, i want to receive 2 strings and divide them in parts, i receive dates (i know i can make it with integers but my teacher wanted to be with strings, and there are better ways to do this, but my point is why my strings act like that) and then calculate the days between this to dates, when i divide the second string my dummy string fill with trash or values from the other 2 strings, here is the part of my file when i divide the 2 strings

#include<stdio.h>
#include<conio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<alloc.h>
void main(void)
{

int dia1,dia2,mes1,mes2,ano1,ano2,dum,i,totdias;
int mes[12];
char *fecha1=malloc(sizeof(char)*9);
char *fecha2=malloc(sizeof(char)*9);
char *dummy=malloc(sizeof(char)*9);
mes[0]=0,mes[1]=31,mes[2]=28,mes[3]=31,mes[4]=30,mes[5]=31,mes[6]=30,
mes[7]=31,mes[8]=31,mes[9]=30,mes[10]=31,mes[11]=30,mes[12]=31;
totdias=0;
clrscr();
gotoxy(5,7);
printf("Format yyyyymmdd (yearmonthday)");
gotoxy(5,11);
printf("First date: ");
scanf("%s",fecha1);

strncpy(dummy,fecha1,4);
ano1=atoi(dummy);
strncpy(dummy,fecha1,6);
dum=atoi(dummy);
mes1=dum-(ano1*100);
strncpy(dummy,fecha1,8);
dum=atoi(dummy);
dia1=dum-((ano1*10000)+(mes1*100));
gotoxy(5,13);
printf("Second date: ");
scanf("%s",fecha2);
free(dummy); //liberate dummy
strncpy(dummy,fecha2,4);
ano2=atoi(dummy);
strncat(dummy,fecha2,6);
dum=atoi(dummy);
mes2=dum-(ano2*100);
strncat(dummy,fecha2,8);
dum=atoi(dummy);
dia2=dum-((ano2*10000)+(mes2*100));
}

i hope u can help me out, im programming on turbo c++ 3 on windows xp, thanks a lot.

Juan

P.S. Sorry for my bad english