Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.xharbour

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 10-30-2007, 01:17 PM
Robert Campsmith
Guest
 
Posts: n/a
Default SAVE and RESTORE

Hello All,

Consider this snippet

PRIVATE cSet := "ONE.SET"
PRIVATE cDet := "WAR07-08F881101WAR07-08F881201"

SAVE ALL LIKE cDet TO (cSet)

cDet := ""

RESTORE FROM (cSet) ADDITIVE

? cDet // displays the contents of the variable


However, in my "real-world" program,

PRIVATE cDetails, cSet := "TWO.SET"

...

cDetails := SomeFunc() // a string of characters

SAVE ALL LIKE cDetails TO (cSet)

...

RESTORE FROM (cSet) ADDITIVE

? LEN(cDetails) // results 0

If I go to DOS and TYPE TWO.SET, the results are
:TH:1:CDET ├ E <DATA>

Of course we are looking for a variable named cDetails.

In Clipper 5.2e it worked as expected.

We are using xBuildW, xHarbour build 0.99.70
Running on WinXP, SP2

Does saving and restoring plain vanilla character type
variables to and from .mem files not work in xHb?

Thanks,
-- Robert
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 10-31-2007, 01:50 AM
N:dlzc D:aol T:com \(dlzc\)
Guest
 
Posts: n/a
Default Re: SAVE and RESTORE

Dear
"Robert Campsmith" <drrobert@sturec.com> wrote in message
news:47273d9a$0$1344$834e42db@reader.greatnowhere. com...
> Hello All,
>
> Consider this snippet
>
> PRIVATE cSet := "ONE.SET"
> PRIVATE cDet := "WAR07-08F881101WAR07-08F881201"
>
> SAVE ALL LIKE cDet TO (cSet)
>
> cDet := ""
>
> RESTORE FROM (cSet) ADDITIVE
>
> ? cDet // displays the contents of the variable


I compile this program, and it displays the text value correctly,
and the value stored in "ONE.SET" shows "CDET" and the text value
unaltered (and correct).

I don't have any flags set to keep from uppercasing the variable
names... could some variant of this be causing your problems?

David A. Smith


Reply With Quote
  #3 (permalink)  
Old 10-31-2007, 03:22 AM
Ron Pinkas
Guest
 
Posts: n/a
Default Re: SAVE and RESTORE

Robert,

> However, in my "real-world" program,
> ...
> Does saving and restoring plain vanilla character type variables to and
> from .mem files not work in xHb?


Not that we are aware of. Unless you can show us how to replicate I feel
confident this must be an application issue rather than xHarbour issue.

Ron


Reply With Quote
  #4 (permalink)  
Old 10-31-2007, 05:14 PM
Robert Campsmith
Guest
 
Posts: n/a
Default Re: SAVE and RESTORE

Ron,

Here is a stand-alone that runs as expected.

FUNCTION Main

SETMODE(25,80)

PRIVATE cSetFile := "ONE.SET"
PRIVATE cDetails := "These are the details..."

SAVE ALL LIKE cDetails TO (cSetFile)

Alert("Just saved "+cDetails+" to "+cSetFile)

cDetails := ''
RELEASE cDetails

Alert("RELEASEd ValType(cDetails) "+ValType(cDetails))
// returns "U"

RESTORE FROM (cSetFile) ADDITIVE

Alert("RESTOREd ValType(cDetails) "+ValType(cDetails))
// returns "C"
Alert("cDetails: "+cDetails)

RETURN( NIL )

In this example, the RELEASEd ValType returns "U" and the
RESTOREd value is correct.

However, this same code in a test stub in my application
does not behave as expected.

****************************************
FUNCTION TEST17()
*
* Purpose: save to .mem
*
PRIVATE cSetFile := "ONE.SET"
PRIVATE cDetails := "These are the details..."

SAVE ALL LIKE cDetails TO (cSetFile)

Alert("Just saved "+cDetails+" to "+cSetFile)

cDetails := ''
RELEASE cDetails

Alert("RELEASEd ValType(cDetails) "+ValType(cDetails))
// returns "C"

RESTORE FROM (cSetFile) ADDITIVE

Alert("RESTOREd ValType(cDetails) "+ValType(cDetails))
// returns "C"
Alert("cDetails: "+cDetails) // returns ""

RETURN( NIL )
*

The RELEASEd ValType returns "C" and the cDetails variable
is empty. The file on disk contains ":TH:1:CDET" as the
variable name. You may click on this link to see the file.
http://www.sturec.com/pickup/00000/one.set

Here is the difference: The little stand alone test program
does not have any declared libraries. My application has
these libraries as part of the build...
Shell32.lib
xhbzipdll.lib
xHBSIP.dll
gdi32.lib
comdlg32.lib
msimg32.lib
Misc.lib
iphlpapi.lib

My guess is that one of these libraries are stepping on
something and causing released variables to still be
declared as ValType "C" and maybe the same or something else
is corrupting my SAVE ALL LIKE

My environment:
Operating System.: Windows XP Professional 5.01.2600 Service
Pack 2
Available Memory.: 1423696
Multi Threading..: Yes
VM Optimization..: 0

Compiler.........: Pelles ISO C Compiler 2.70
xHarbour Version.: xHarbour build 0.99.70 Intl. (SimpLex)
Build Date.......: Dec 20 2006 13:26:02


Thanks,
-- Robert



Ron Pinkas wrote:
> Robert,
>
>> However, in my "real-world" program,
>> ...
>> Does saving and restoring plain vanilla character type variables to and
>> from .mem files not work in xHb?

>
> Not that we are aware of. Unless you can show us how to replicate I feel
> confident this must be an application issue rather than xHarbour issue.
>
> Ron
>
>

Reply With Quote
  #5 (permalink)  
Old 10-31-2007, 10:46 PM
Ron Pinkas
Guest
 
Posts: n/a
Default Re: SAVE and RESTORE

Robert

> However, this same code in a test stub in my application does not behave
> as expected.


Unless you can show us how to reproduce it in a reduced sample, ther's not
much we can do.

Ron


Reply With Quote
  #6 (permalink)  
Old 11-01-2007, 02:23 PM
Robert Campsmith
Guest
 
Posts: n/a
Default Re: SAVE and RESTORE

Ok, I took a chance that someone may know of a "known issue"
with one of the libraries.

-- Robert

Ron Pinkas wrote:
> Robert
>
>> However, this same code in a test stub in my application does not behave
>> as expected.

>
> Unless you can show us how to reproduce it in a reduced sample, ther's not
> much we can do.
>
> Ron
>
>

Reply With Quote
  #7 (permalink)  
Old 11-01-2007, 04:43 PM
cherszage@gmail.com
Guest
 
Posts: n/a
Default Re: SAVE and RESTORE

Robert

Did u try including these same libraries in the test program ?

Claudio


Reply With Quote
  #8 (permalink)  
Old 11-05-2007, 02:48 PM
Robert
Guest
 
Posts: n/a
Default Re: SAVE and RESTORE

On Nov 1, 12:43 pm, chersz...@gmail.com wrote:
> Robert
>
> Did u try including these same libraries in the test program ?
>
> Claudio


Yes Claudio. I thought of that. They are not in the same order, does
that matter?

-- Robert

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save and restore titles and footnotes. data _null_; Newsgroup comp.soft-sys.sas 2 05-05-2005 01:41 PM
Re: Save and restore titles and footnotes. Quentin McMullen Newsgroup comp.soft-sys.sas 1 05-04-2005 11:01 PM
Re: Save and restore titles and footnotes. Fehd, Ronald J Newsgroup comp.soft-sys.sas 0 05-04-2005 08:58 PM



All times are GMT. The time now is 10:00 AM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.