Parsing a typed file

Posted on 2003-03-09
Medium Priority
Last Modified: 2010-04-04
hi! i have a file of unknown record type.  is there a way to find out what my file of record is composed of? thanks in advance!
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8100668

At least, not with any certainty.

All files would be accessible as a file of byte, but that's hardly useful - you probably want to know how to get the records out of the file - whatever the records are.

If the file was created using 'file of type', then all the records are the same length, so the record length must be a factor of the filesize. If you have different versions of the file, you may be able to calculate the length by calculating all of the possible factors of the various different versions, and the ones that are common are the likely record sizes.

Having found the record size, then you've got to determine the structure - quite another ball-game.

It may be a text file, where reading with the text type would work.

There may be a variable-length record structure where a particular byte may mark the end-of-record. This byte may or may not be used exclusively as end-of-record, for instance if you
  write(file,x,y,#4);  write(file,j,k,#4);

  where x and j are integers and y and k are different-length strings, then a hex '04' byte may occur as part of the integer, but will occur at the end-of-record, while the record length is variable(but marked by a hex '04' byte)

So it may or may not be comprehensible other than to the application that created it.


Accepted Solution

ILE earned 1500 total points
ID: 8107624
now with the code

when u wona read any file

var fil: file of byte;
seekfile(file,pos);  {pos is position what byte u wona read}
readfile(file,b)     {in b u got the bute u read}
this metod with eny seek will be read just one byte an mey use for read any file

when u use a typed file this is a file with known structure

var file file of recstruc; {where recstruc is any type}

seekfile(file,pos);  {pos is position what record u wona read}
readfile(file,b)     {in b u got the record u wona read}


Author Comment

ID: 8108940
any other ideas? thanks :)

Expert Comment

ID: 9316869
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month9 days, 21 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question