I am facing a weird problem when i try to write the contents of a char array into a file.
I first do:
here, buf points to the starting location of my char array...Code:fp=fopen(filename,"w"); fprintf( fp1 ,"%s" , buf); fclose(fp);
the contents of this array will be re-written during the execution , and so, to transfer the new content into a file I do :
again , here buf points to the start ...Code:fp=fopen(filename,"a"); fprintf( fp1 ,"%s",buf); fclose(fp);
the problem is : after the execution , when i open the file with "cat" , the contents of the file is displayed correctly..
when i open it thru a text editor, I see non-ascii characters at the end of each line