I have a strange problem:
I read a file into a buf and tried to run it in ssh (Linux)..
my file contains:
We
I
a
so this is my buf:
now I create a new file and paste the buf into this new file:
FILE*nem_file_name;
nem_file_name= fopen("email1.clear","wb"); //create the file if not exist.
fwrite (buf, sizeof(char), strlen(buf),nem_file_name); //write the new sensored mail to the file.
in this case, the file: email1.clear was created, but this is what it contains:
We Ia
when I copy it to clipboard and paste it to this topic, it was pasted so:
We
I
a
why there is no 'end line' in my file? I want it to be like what I have in my clipboard :/
UPDATE I tried to create the buf manually by:
char buf[10];
buf[0] = 'W';
buf[1] = 'e';
buf[2] = 32;
buf[3] = 13;
buf[4] = 10;
buf[5] = 'I';
buf[6] = 13;
buf[7] = 10;
buf[8] = 'a';
buf[9] = 0;
(note that I didn't read a file into buf, but do it manually)
and then:
FILE*nem_file_name;
nem_file_name= fopen("email1.clear","wb"); //create the file if not exist.
fwrite (buf, sizeof(char), strlen(buf),nem_file_name);
and the file email1.clear
was created as I want:
We
I
a
I can't understand it!