Hello every one!Please help me!!
I am new to C programming.I wrote a programe to copy lines one by one of a file to an array.But it cant compile.I cant understand the error code also.Please help me!
here is my code.
#include<stdio.h>
int main()
{
FILE *f;
char data[256]={0};
char c[128]={0};
int i=0;
if((f=fopen("C:\data.txt","r"))==NULL){
printf("File cant open....\n");
}
else{
while(fgets(data,50,f)!=NULL){
printf("data[%d]:%s",i,data);
c[i]=strdup(data);
sprintf(c[i],data);
i++;
}
fclose(f);
}
}