Writing Byte to file, how can i start new line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

i have a byte array, and i'm writing it to a file, i want to start a new
line, how can i do it? (like WriteLine in StreamWriter)

I'm using FileStream:
FileStream fs = new FileStream(file_name,FileMode.Create );

Aftrer i used fs.Write(Byte[] b1);
i want to start a new line in my file and then write my second array Byte[]
b2.

how can i do it?

Thanks,
Gidi.
 
Gidi said:
Hi,

i have a byte array, and i'm writing it to a file, i want to start a new
line, how can i do it? (like WriteLine in StreamWriter)

I'm using FileStream:
FileStream fs = new FileStream(file_name,FileMode.Create );

Aftrer i used fs.Write(Byte[] b1);
i want to start a new line in my file and then write my second array
Byte[]
b2.

how can i do it?

Well, how do you define a new line? Is this a text file(and would using
StreamWriter be abetter option?) or is it a binary file? the characters '\n'
and '\r' are the usual newline characters but without knowing the encoding
its impossible to tell you exactly what to do.
 
Bytes 10 and 13 are usually new line and carriage return, so try writing
these to start new line
 
Gidi said:
i have a byte array, and i'm writing it to a file, i want to start a new
line, how can i do it? (like WriteLine in StreamWriter)

I'm using FileStream:
FileStream fs = new FileStream(file_name,FileMode.Create );

Aftrer i used fs.Write(Byte[] b1);
i want to start a new line in my file and then write my second array Byte[]
b2.

how can i do it?

Binary files don't *have* lines - they're just sequences of bytes.
What's going to read this, and what's it expecting?
 
Back
Top