• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 7199
  • Last Modified:

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
0
Ruttensoft
Asked:
Ruttensoft
3 Solutions
 
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now