Monday, May 24, 2010

Read in a binary file in c# and then write it again.?

How do I do this?





I don't want to read a text file but something like a JPG. When I read it into a string and then write it again the result is not an identical copy.

Read in a binary file in c# and then write it again.?
you cannot read binary data into a string, you need to use a byte array.





strings are meant for text data in most programming languages, and non-text data will produce various weird results/exceptions/errors





here is a sample of a read: http://www.yoda.arachsys.com/csharp/read...





for a write you can use Response.BinaryWrite()


No comments:

Post a Comment