Thanks,
One more question. I used to use MemMove for fixed length
structures, to copy from Database to structure. I now use
DmWrite and write each variable one at a time since I no
longer have a fixed length structure.
I don't see a cooresponding DmRead type function. What is
the best way to read one variable at a time from a DB record?
Say I have variables that are:
Int var1;
Int var2;
char String1[Max]; // actual string length varies
char String2[Max]; // actual string length varies
and my record is: var1, var2, String1, String2 (where the
actual string length for 1 and 2 varies.
What is the best way to read this data into their cooresponding
variables?
This was so much easier with fixed length records, but I don't want
to waste memory and would like to only write significant data.
Thanks
Date sent: Sun, 16 May 1999 17:30:28 -0700
From: "Creative Digital Publishing Inc." <[EMAIL PROTECTED]>
Subject: Re: DmWrite Function question
To: [EMAIL PROTECTED]
Send reply to: [EMAIL PROTECTED]
> >Does DmWrite and other Dm functions take care of reallocation and sizing
> >of memory?
>
> No. Basically, you need to use a sequence like this:
>
> recH = DmGetRecord ( database, index )
> oldrecsize = MemHandleSize ( recH );
> if ( oldrecsize != newrecsize ) {
> err = MemHandleResize ( recH, newrecsize );
> recH = ResizeRecord ( recH, index, newrecsize);
> }
> recP = MemHandleLock ( recH );
> error = DmWrite ( recP, 0, bufferPointer, newrecsize );
> MemHandleUnlock ( recH );
> error = DmReleaseRecord ( database, index, true );
>
> Note: this is abbreviated and contains no error checking.
>
> Regards,
> Steve Mann
>
> -------------------------------------------
> Creative Digital Publishing Inc.
> 1317 Palm Street, San Luis Obispo, CA 93401-3117
> -------------------------------------------
> 805.788.0138 805.593.3811 (fax)
> [EMAIL PROTECTED] http://www.cdpubs.com
>
>
>
--
-----------------------------------------------------------------
Discussion Group: http://www.halcyon.com/ipscone/wwwboard/
Protect your constitutional rights. Your favorite one may be next!
-----------------------------------------------------------------