StreamWriter.Write: Not possible to write byte array? Only Char array?

Hello

I need to write an array to a file with StreamWriter. I am now using a Char Array as StreamWriter.write does only support char arrays, not byte arrays...

Now how can I flush the char array when I dont need it anymore?

Thanks

Sven
RuttensoftAsked:
Who is Participating?
 
Solar_FlareCommented:
im not quite sure what you are asking... you want to clear the char array? in VB you could do chararray = nothing


you can convert binary data to a base64 string and write it as a string if that helps..

streamwriter.Write(convert.ToBase64String(bytearray))

and then use convert.FromBase64String to turn it back into a byte array froma string when you read it back.
0
 
Bob LearnedCommented:
BinaryWriter can write byte array.

Bob
0
 
RuttensoftAuthor Commented:
Thnx a lot for your answers, actually chararray = nothing is all I needed!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.