TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Administrator
Tech Writer
2.2k
1.5m
Binary data reading
Mar 14 2003 10:46 AM
Hi! I am having problem reading binary ( in fact any file) file using the following code: Here is the code: FileStream fs=new FileStream("C:\abc.dat", System.IO.FileMode.Open, System.IO.FileAccess.Read); byte[] b=new byte[fs.Length - 1]; int fslen=(int) fs.Length; fs.Read(b,0,fslen); I am getting error: Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection. Same code works fine with vb: Dim f As System.IO.File Dim fs As System.IO.FileStream fs = f.Open("C:\abc.dat ", IO.FileMode.Open, IO.FileAccess.Read) Dim b(fs.Length - 1) As Byte fs.Read(b, 0, fs.Length) any idea? Thanks in Advance.
Reply
Answers (
2
)
static destructor?
C#/.Net Developer position in NYC