How to read binary file in C#

Posted by Ali under C# on 3/16/2010 | Views : 12480 | Status : [Member] | Replies : 2
Hi i have two questions

1- How to read binary file in C#, read all records one by one and display ?

2- I am working on client/server application. When money is withdraw from account on server, client should know the update balance and if another client is accessing same account, he should have also update balance. I mean remaining balance should be update in all clients sites. How to do this? using threading or any other technique ?




Responses

Posted by: Syedshakeer on: 3/16/2010 [Member] Starter

Up
0
Down
Hi Ali ,

check the follwoing Link for how to read Binary file:-
http://dotnetperls.com/binaryreader

Syed Shakeer Hussain

Ali, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sagarp on: 3/17/2010 [Member] Bronze

Up
0
Down
private void save()

{
StreamReader r = new StreamReader(new FileStream(textBox2.Text, FileMode.Open));
string img1 = r.ReadToEnd();
long len1 = r.BaseStream.Length;
r.Close();
BinaryReader n = new BinaryReader(new FileStream(textBox2.Text, FileMode.Open));
byte img1b;
while (n.BaseStream.Position < len1)
{
img1b = n.ReadByte();
}


}


Thanks
SagarP
http://www.emanonsolutions.net
http://emanonsolutions.blogspot.com/

Ali, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response