[Webinar] Streamline your web hosting managementRegister Today


Using TFileRec to store data in Userdata

Posted on 2000-02-01
Medium Priority
Last Modified: 2010-04-04
How do I store data in TFileRec's UserData field in a Typed file?
Moving the data can be done by using Move function, but how to access a file, and write into the UserData field?
Question by:Ram_Sambamurthy
  • 2

Accepted Solution

egono earned 150 total points
ID: 2478718
I dont know what you want to do but since TFileRec.UserDate is a array of byte you might try


be sure that SizeOf(YourData)<=SizeOf(YourFileRec.UserData)


Author Comment

ID: 2491889
Edited text of question.

Author Comment

ID: 2491898
I know that to Move is the way to transfer the data, but how to actually access the disk file, and write data into the UserData field of TFileRec. Anyway, I found the answer in Delphi 4 developer's guide by Xavier Pacheco, and Steven Teixeira.

The way is to do:
cFileName := 'c:\xxx';
AssignFile(SomeFile, cFileName);

TFileRec(SomeFile).UserData := ....

what i did wrong was to declare

MyFileRec : TFileRec;  //and then
MyFileRec(SomeFile).UserData := ...
                       //which did not work.

thanks for your help.

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Planning to migrate your EDB file(s) to a new or an existing Outlook PST file? This video will guide you how to convert EDB file(s) to PST. Besides this, it also describes, how one can easily search any item(s) from multiple folders or mailboxes…
There may be issues when you are trying to access Outlook or send & receive emails or due to Outlook crash which leads to corrupt or damaged PST file. To eliminate the corruption from your PST file, you need to repair the corrupt Outlook PST file. U…
Suggested Courses

612 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