Parsing a typed file

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!
dabestprogrammerindauniverseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

billiousCommented:
No.

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.

...Bill
0
ILECommented:
now with the code


when u wona read any file

var fil: file of byte;
   pos:longint;
    b:byte;  
begin
assignfile(fil,'filename');
reset(file)
seekfile(file,pos);  {pos is position what byte u wona read}
readfile(file,b)     {in b u got the bute u read}
closefile(fil);
end;
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}
b:rectrruc;
  pos:longint;

begin
assignfile(fil,'filename');
reset(file)
seekfile(file,pos);  {pos is position what record u wona read}
readfile(file,b)     {in b u got the record u wona read}
closefile(fil);
end;





0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dabestprogrammerindauniverseAuthor Commented:
any other ideas? thanks :)
0
CleanupPingCommented:
dabestprogrammerindauniverse:
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 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.