muskan
30th August 2011, 05:52
hello,
In my code i opened a file and write in it now i want each time i reopen it,data must be written from next line.
my code snippet is:
unsigned char buffer[8]={0};
int cmd=1;
int tt=100;
tt<<16;
tt|cmd;
sprintf((char*)buffer,"%d",tt);
FILE *fp;
fp=fopen("root/test.txt","a");
if(fp==NULL)
perror("file pointer:");
fwrite(buffer 8,1,fp);
fclose(fp);
I also searched but did'nt got any right answer. I want my new text will come at the beginning of next line each time i write. please help me out.
Thanks in advance
In my code i opened a file and write in it now i want each time i reopen it,data must be written from next line.
my code snippet is:
unsigned char buffer[8]={0};
int cmd=1;
int tt=100;
tt<<16;
tt|cmd;
sprintf((char*)buffer,"%d",tt);
FILE *fp;
fp=fopen("root/test.txt","a");
if(fp==NULL)
perror("file pointer:");
fwrite(buffer 8,1,fp);
fclose(fp);
I also searched but did'nt got any right answer. I want my new text will come at the beginning of next line each time i write. please help me out.
Thanks in advance