Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Fixed Lenght File with FileGet Byte Array

Status
Not open for further replies.

UncleCake

Technical User
Feb 4, 2002
355
0
0
US
Hi, I am trying to read a file that has fixed length records and is indexed. The array has 200 elements. My FileGet reads like this:
Code:
FileGet(FileNumber, FileData(0), RecordNumber)

I am only getting one character in place "0" and I don't even know if that is correct. Does anyone have any experience with this?

 
If I were you I'd check the validity of FileNumber and RecordNumber as well. This assumes that in this code the FileData is an array of size X, where X is the physical record size?

Also, you may want to make your life easier and create a couple of custom classes. Class A would be an Item class i.e. a class representation of your Record, and Class B would be a collection of these.

You could then simply read a record at a time and add it to the collection. Or even better serialise it onto and off of disk.


--
Woogoo

 
Thanks Woogoo, I was finally able to read the record (after 3 days of working on it), but I have a 'Warning' about the Implicit conversion from 'System.Array' to '1-dimensional array of Byte'....

I will have to see what this means and go from there.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top