943,908 Members | Top Members by Rank

Ad:
Feb 10th, 2009
0

USing a short string to store data

Expand Post »
I am working on a project for a Cad program in which I must embed data in the Cad file. The tools for doing so in the cad program allow for embedding boolean, integer, double byte and string values, one at a time. There is a lot of data and the best way to store it would be in a single packet. The best option then appears to be using strings. The string data type in the Cad program is limited to 255 characters. I could enter the data in the string as comma delimited items, but wonder if it could be packed tighter by assembling the data as individual byte packets in a string and storing it that way. My instincts tell me that won't work in in pascal/delphi, because of carriage returns and linefeeds etc., but I am not sure. Can anyone shed some light on this or steer me to some resources / samples that could help?
Similar Threads
Reputation Points: 11
Solved Threads: 11
Junior Poster in Training
jsosnowski is offline Offline
68 posts
since Nov 2007
Feb 11th, 2009
0

Re: USing a short string to store data

Strings can contain line feeds etc
Reputation Points: 196
Solved Threads: 190
Posting Virtuoso
LizR is offline Offline
1,735 posts
since Aug 2008
Feb 11th, 2009
0

Re: USing a short string to store data

Thanks, I realized my error, but on the way I also discovered the use of "absolute" to align the memory of two types. I am self educated which means there are often little holes in my bigger picture. I love these little surprises. Lots of possiblities for this one!
Reputation Points: 11
Solved Threads: 11
Junior Poster in Training
jsosnowski is offline Offline
68 posts
since Nov 2007
Feb 16th, 2009
0

Re: USing a short string to store data

I'm not sure if this will fit your needs exactly but you can read/write a struct in files (http://delphi.about.com/od/fileio/a/fileof_delphi.htm). If the data is embedded in a cad file then make the first part of your struct a 5 byte "Signature" and assign 5 unique values that make up the signature. You can then locate the signature in the CAD file and read SizeOf(struct) to get your data out.

It is binary so these files are not always portable across different platforms
Featured Poster
Reputation Points: 1749
Solved Threads: 735
Senior Poster
sknake is offline Offline
3,948 posts
since Feb 2009
Feb 16th, 2009
0

Re: USing a short string to store data

Thanks sknake!

No it doesn't fit my needs, but it is another interesting idea. The problem with CAD files is that they are not standard databases. There are too many variable types to define different types of drawing "entities" many with attached attributes that are not necessarily in the same memory area. Everything is linked with page addresses. Direct read and write is a very risky propsect. Fortunately there are plenty of tools for interogating the data. In my case I was looking for a way of providing additional information in a consolidated packet. A string is an easy, compact means of doing so.

Thanks for the help.
Reputation Points: 11
Solved Threads: 11
Junior Poster in Training
jsosnowski is offline Offline
68 posts
since Nov 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Pascal and Delphi Forum Timeline: Stored Procedure Question
Next Thread in Pascal and Delphi Forum Timeline: [Pascal] Client/Server: Can send only one time a message





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC