I'm reading data from a file word by word and trying to store in same buffer with space between every word. But words are coming out without space. Please tell me what is wrong? output coming aniljaiswalvikaskumarnikhilkumarindia but i want space between each word.
int main()
{
char buff[200];
int l=0;
FILE *fp;
fd = NULL;``
fp = fopen("header.c","r");
memset(buff,0,200);
while(1)
{
fscanf(fp,"%s",buff+l);
l=strlen(buff);
printf("Word of string = %s\n",buff);
printf("Length of string = %d\n",l);
if(feof(fp))
{
break;
}
}
fclose(fp);
return 0;
}
buffafter eachscanf