Solved

File of records related question.

Posted on 2004-08-12
1
224 Views
Last Modified: 2010-04-05
Hi,

i just need some information regarding a file of records.

U see i have this record type :
TGsmRecord = record
  DateAdded : TdateTime;
  GsmNumber : String[25];
 end;

and a file of TGsmRecord where i save all my TGsmrecords in. and i just do Write(File,TgsmRecordVar);
I noticed each record takes up 40 bytes in the file. When i looked at the file i noticed something about the Shortstring Gsmnumber.
1.K.v..@.0111111111ewList....`..`C..,... is one record in the file where Gsmnumber equaled 0111111111 (10 chars). Notice the text after the 0111111111 part, it says "ewList" which comes from viewlist which is part of a name used for one of my controls in the program (a listview).

I like to know if this is normal ? it's probably because The shortstring has always a static length. But i find it weird that when i load up my records from the file again. The number is recognized as just 0111111111. and the "Garbage" doesn't affect my records / program at all.

I just like to know if it would ever make my program crash or sumthing or make the loaded Gsmnumber have a diffrent value from the one saved into the file due to the garbage.

0
Comment
Question by:joyrider
1 Comment
 
LVL 7

Accepted Solution

by:
LRHGuy earned 50 total points
ID: 11784898
it's normal for there to be uninitialized "trash" in records, unless you initialize them...

Before saving, try something like:

var
  R:tGsmRecord;
begin
  fillchar(R,sizeof(R),0);  //clear out record
  R.Dateadded:=  //put in date
  GSMNumber:= //put in number
  write(File,R);  //save to file
end
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
System restore point 4 91
how do i create updater to My Activex application? 3 79
TVirtualStringTree  search using TEdit 7 106
Communication Between RC4 Delphi <-> PHP 3 100
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now