Click here to Skip to main content
15,917,702 members
Home / Discussions / C#
   

C#

 
GeneralRe: error in crystal reports Pin
monuSaini16-Oct-07 19:39
monuSaini16-Oct-07 19:39 
Questioncan't reasign byte[] array :S Pin
Patricio Tapia12-Oct-07 20:27
Patricio Tapia12-Oct-07 20:27 
AnswerRe: can't reasign byte[] array :S Pin
Guffa13-Oct-07 0:06
Guffa13-Oct-07 0:06 
QuestionConverting *ANY* file to Binary and back [modified] Pin
Ian Uy12-Oct-07 19:30
Ian Uy12-Oct-07 19:30 
AnswerRe: Converting *ANY* file to Binary and back Pin
led mike12-Oct-07 20:20
led mike12-Oct-07 20:20 
GeneralRe: Converting *ANY* file to Binary and back Pin
Ian Uy12-Oct-07 20:22
Ian Uy12-Oct-07 20:22 
GeneralRe: Converting *ANY* file to Binary and back Pin
led mike12-Oct-07 20:37
led mike12-Oct-07 20:37 
AnswerRe: Converting *ANY* file to Binary and back Pin
mav.northwind12-Oct-07 20:22
mav.northwind12-Oct-07 20:22 
Hi!
Not quite sure what you mean by "Binary/Byte" - every file (no matter if it is a jpg or a doc or something else) is just a bunch of bytes in a certain order.
The only meaning implied on this stream of bytes is the one given by applications that can interprete the data in a given way.
When you try to load a .doc file into your favourite image processor (probably having to rename the file to do so), it'll choke on the data because it cannot be interpreted as an image.

Anyway, you can read any file into a byte array using classes from the System.IO namespace and then get a base64 string from this array using Convert.ToBase64String().
This base64 string is something you can write to a text file (i.e. a file with all of its bytes in the limited range of printable characters).
The way back is straightforward: Read the base64 string from the text file, convert it to a byte[] with Convert.FromBase64String() and write the array to a binary file.

Regards,
mav

--
Black holes are the places where God divided by 0...

GeneralRe: Converting *ANY* file to Binary and back Pin
Ian Uy12-Oct-07 20:30
Ian Uy12-Oct-07 20:30 
GeneralRe: Converting *ANY* file to Binary and back Pin
led mike12-Oct-07 20:34
led mike12-Oct-07 20:34 
GeneralRe: Converting *ANY* file to Binary and back Pin
Ian Uy12-Oct-07 21:18
Ian Uy12-Oct-07 21:18 
GeneralRe: Converting *ANY* file to Binary and back Pin
Daniel Grunwald12-Oct-07 23:42
Daniel Grunwald12-Oct-07 23:42 
GeneralRe: Converting *ANY* file to Binary and back Pin
Ian Uy12-Oct-07 23:53
Ian Uy12-Oct-07 23:53 
GeneralRe: Converting *ANY* file to Binary and back Pin
Colin Angus Mackay13-Oct-07 0:01
Colin Angus Mackay13-Oct-07 0:01 
AnswerRe: Converting *ANY* file to Binary and back Pin
Guffa13-Oct-07 0:19
Guffa13-Oct-07 0:19 
GeneralRe: Converting *ANY* file to Binary and back Pin
Ian Uy13-Oct-07 0:59
Ian Uy13-Oct-07 0:59 
GeneralRe: Converting *ANY* file to Binary and back Pin
Guffa13-Oct-07 3:55
Guffa13-Oct-07 3:55 
QuestionBegin printing at row x column y Pin
Roger CS12-Oct-07 18:17
Roger CS12-Oct-07 18:17 
AnswerRe: Begin printing at row x column y Pin
led mike12-Oct-07 20:33
led mike12-Oct-07 20:33 
GeneralRe: Begin printing at row x column y Pin
Roger CS12-Oct-07 23:03
Roger CS12-Oct-07 23:03 
GeneralRe: Begin printing at row x column y Pin
Dave Kreskowiak13-Oct-07 3:04
mveDave Kreskowiak13-Oct-07 3:04 
GeneralRe: Begin printing at row x column y [modified] Pin
Roger CS13-Oct-07 11:29
Roger CS13-Oct-07 11:29 
GeneralRe: Begin printing at row x column y Pin
Roger CS14-Oct-07 15:17
Roger CS14-Oct-07 15:17 
GeneralRe: Begin printing at row x column y Pin
led mike15-Oct-07 4:52
led mike15-Oct-07 4:52 
AnswerRe: Begin printing at row x column y Pin
darkelv14-Oct-07 19:04
darkelv14-Oct-07 19:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.