Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
how to get data from a binary file and display it in a DataGridView in c #. appreciate the help.
Posted
Comments
Gopi Kishan Mariyala 11-Nov-13 10:11am    
Can you please tell us in detail what does the binary file contain (Ex. is it text or image file). How would you like to display it
mcggiber 11-Nov-13 10:16am    
is a text file.
Gopi Kishan Mariyala 11-Nov-13 10:18am    
Can we directly convert to text and display? Does it contains rows of data?
mcggiber 11-Nov-13 10:20am    
yes..
mcggiber 11-Nov-13 10:22am    
contiene filas

static string ConvertBinaryToText(List<list><int>> seq){
    return new String(seq.Select(s => (char)s.Aggregate( (a,b) => a*2+b )).ToArray());
}

static void Main(){
   string s = "stackoverflow";
   var binary = new List<list><int>>();
   for(var counter=0; counter!=s.Length; counter++){
       List<int> a = ConvertTextToBinary(s[counter], 2);
       binary.Add(a);
       foreach(var bit in a){
           Console.Write(bit);
       }
       Console.Write("\n");
   }
   string str = ConvertBinaryToText(binary);
   Console.WriteLine(str);//stackoverflow
}</int></int></list></int></list>
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900