Hi everyone,

I've to change a program, and got a problem with a memory file.

The file is loaded at the beginning of the program, and changed
afterwhat with new user's values. Access to data depends of these
memory info. So each time a new user come to see data, he get the
memory file of the last user, and the program bug. If this new user
come a second time, the memory file contain correct info, saved from
his previous visit, and then the data are accesibles.

If I could change this mem file with the good data during a session,
and reload these just as if these were on this mem file, I wouldn't
have more problems. But for now I need my users to log to times...

So I've three questions :

1- I can't see anywhere on the program where is loaded the mem file,
neider when or where is it changed. Is it automatique ? Can I search
through my code by an automatique way the lines of code where is loaded
this file ? (I really didn't find theses lines !)

2-Is that possible to write on this memory file when the user gave me
the "good" info, in order to simulate a "reload" so that the program
could see this "new" info as if it was on the mem file at the beginning
of the program ?

3-I tried to change by hand the infos in this file, but then vfp say
"Memory file is invalid". Is it possible to write on a mem file,
without changing it on a "invalid" mem file ? Is it possible to get the
format of each field, and change the info ? How do we do it ?

I hope I'm clear on what is my problem... I searched througth the net
and google to have answers, but I didn't find a lot of infos... Any
help welcome, and thanks by advance.

Regards.
JR.

Re: vfp 7 : memory file structure ? by David

David
Wed Aug 24 21:28:50 CDT 2005

JR,

Look for the SAVE TO and RESTORE FROM commands in the code.

As far as how the data stored in there is used you should be able to create
some code to keep from restoring inappropriate values back.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro

<jouinromain@campus.ie> wrote in message
news:1124935811.467351.209360@f14g2000cwb.googlegroups.com...
> Hi everyone,
>
> I've to change a program, and got a problem with a memory file.
>
> The file is loaded at the beginning of the program, and changed
> afterwhat with new user's values. Access to data depends of these
> memory info. So each time a new user come to see data, he get the
> memory file of the last user, and the program bug. If this new user
> come a second time, the memory file contain correct info, saved from
> his previous visit, and then the data are accesibles.
>
> If I could change this mem file with the good data during a session,
> and reload these just as if these were on this mem file, I wouldn't
> have more problems. But for now I need my users to log to times...
>
> So I've three questions :
>
> 1- I can't see anywhere on the program where is loaded the mem file,
> neider when or where is it changed. Is it automatique ? Can I search
> through my code by an automatique way the lines of code where is loaded
> this file ? (I really didn't find theses lines !)
>
> 2-Is that possible to write on this memory file when the user gave me
> the "good" info, in order to simulate a "reload" so that the program
> could see this "new" info as if it was on the mem file at the beginning
> of the program ?
>
> 3-I tried to change by hand the infos in this file, but then vfp say
> "Memory file is invalid". Is it possible to write on a mem file,
> without changing it on a "invalid" mem file ? Is it possible to get the
> format of each field, and change the info ? How do we do it ?
>
> I hope I'm clear on what is my problem... I searched througth the net
> and google to have answers, but I didn't find a lot of infos... Any
> help welcome, and thanks by advance.
>
> Regards.
> JR.
>



Re: vfp 7 : memory file structure ? by man-wai

man-wai
Thu Aug 25 06:57:55 CDT 2005

David Frankenbach wrote:
> JR,
>
> Look for the SAVE TO and RESTORE FROM commands in the code.
>
> As far as how the data stored in there is used you should be able to create
> some code to keep from restoring inappropriate values back.
>
some programmers may just code "REST FROM" for "RESTORE FROM". We only
need 4 letters of each reserved words.

--
.~. Might, Courage, Vision. http://www.linux-sxs.org
/ v \
/( _ )\ Linux 2.4.31
^ ^ 7:57pm up 1 day 23:34 load average: 0.00 0.01 0.06

Re: vfp 7 : memory file structure ? by Dan

Dan
Thu Aug 25 10:51:22 CDT 2005

man-wai chang wrote:
> David Frankenbach wrote:
>> JR,
>>
>> Look for the SAVE TO and RESTORE FROM commands in the code.
>>
>> As far as how the data stored in there is used you should be able to
>> create some code to keep from restoring inappropriate values back.
>>
> some programmers may just code "REST FROM" for "RESTORE FROM". We only
> need 4 letters of each reserved words.

The good ones don't. <g>



Re: vfp 7 : memory file structure ? by jouinromain

jouinromain
Thu Aug 25 13:41:40 CDT 2005

Thanks for your comments,

Unfortunatelly, these commands no allow me to simulate a new starting
of the program...

Furthemore I still don't have any idea of where and how the program
read this file, where does it store value, why does it need it...

I try to debug it with "display memory" command, but I simply can't see
anything moving, and restoring file doesn't seem to change anything...
I'm stuck...

Regards,
JR.


Re: vfp 7 : memory file structure ? by jouinromain

jouinromain
Thu Aug 25 14:02:08 CDT 2005

Hello,

I'm still blocked with my memory file problem.

I can't find out how vfp decide to write something on this file.
I don't understand why are the 4 variables that are on my mem file, and
no others one.

Is there a way to search on the code where this file is accessed ? ( I
really can't find any line of code doing it)

What is the command to write/read/know-the-structure of such file ?
"Restore fom" and "save to" doesn't seem useful.

Is there a mean to simulate a second launch of a program ?

Thanks.
JR.


Re: vfp 7 : memory file structure ? by Gene

Gene
Thu Aug 25 15:21:27 CDT 2005

On 25 Aug 2005 12:02:08 -0700, jouinromain@campus.ie wrote:

[snip]

>What is the command to write/read/know-the-structure of such file ?
>"Restore fom" and "save to" doesn't seem useful.

RTFM. The command to write is SAVE TO. The command to read is
RESTORE FROM. Once restored, look at the memvars with DISPLAY MEMORY,
etc.

[snip]

Sincerely,

Gene Wirchenko


Re: vfp 7 : memory file structure ? by Dan

Dan
Thu Aug 25 15:43:43 CDT 2005

Your question has been answered.

The command to write to the file is SAVE TO. To restore, the commmand is
RESTORE FROM.

SAVE TO takes an optional skeleton. It's possible, using naming conventions,
to save only global variables with something like SAVE TO file.mem ALL LIKE
g*.

The other possibility is that this isn't a Fox memory file at all and you've
made up a name for something you don't recognize that just happens to be
exactly the same as a name that really means something.

Which is it? If there isn't SAVE TO or RESTORE FROM anywhere in the source,
what makes you think it's a mem file? It can't be one of those without using
these two commands.

Dan

jouinromain@campus.ie wrote:
> Hello,
>
> I'm still blocked with my memory file problem.
>
> I can't find out how vfp decide to write something on this file.
> I don't understand why are the 4 variables that are on my mem file,
> and no others one.
>
> Is there a way to search on the code where this file is accessed ? ( I
> really can't find any line of code doing it)
>
> What is the command to write/read/know-the-structure of such file ?
> "Restore fom" and "save to" doesn't seem useful.
>
> Is there a mean to simulate a second launch of a program ?
>
> Thanks.
> JR.



Re: vfp 7 : memory file structure ? by jouinromain

jouinromain
Thu Aug 25 16:16:48 CDT 2005

I think this file is a vfp memory file because if I erase it before to
launch my prog, it is re-created by the prog once launched.

Furthemore the program's behaviour depends of what is on this file :
there is a change of values when I launch my program :

At first time it reads the values of the last session from the file and
store it who know where (I don't know how or where, I can't find a
RESTORE or SAVE TO command) .
Then it takes new info of the user (the username) and write this new
username in the mem file.
Later on, there is a test that check the actual username with the
username loaded at the begining of the program. The two name no
correspond if it's the first time the user connects himself to the
program, and the program bug.

If the user connect himself a second time, the program load the values
from the mem file. In the mem file, there is the username writed down
at the last connection, so the usernames will be the same, and the
program doesn't bug.

I really don't understand what is going on.
Furthemore there are four variable on this mem file : username,
usertype, userprog. Why these four one's ? I can't say . When are they
loaded ? I can't say !

I tryed to make a search for file containing "save to" or "restore
from" thanks to the explorer, nothing come out...

I'm lost.

Thx for reading,
regards.
JR.


Re: vfp 7 : memory file structure ? by Jack

Jack
Thu Aug 25 16:53:26 CDT 2005

Have you tried to search the source for the file name? That might
point you to the code that reads and writes it.

On 25 Aug 2005 14:16:48 -0700, jouinromain@campus.ie wrote:

>I think this file is a vfp memory file because if I erase it before to
>launch my prog, it is re-created by the prog once launched.
>
>Furthemore the program's behaviour depends of what is on this file :
>there is a change of values when I launch my program :
>
>At first time it reads the values of the last session from the file and
>store it who know where (I don't know how or where, I can't find a
>RESTORE or SAVE TO command) .
>Then it takes new info of the user (the username) and write this new
>username in the mem file.
>Later on, there is a test that check the actual username with the
>username loaded at the begining of the program. The two name no
>correspond if it's the first time the user connects himself to the
>program, and the program bug.
>
>If the user connect himself a second time, the program load the values
>from the mem file. In the mem file, there is the username writed down
>at the last connection, so the usernames will be the same, and the
>program doesn't bug.
>
>I really don't understand what is going on.
>Furthemore there are four variable on this mem file : username,
>usertype, userprog. Why these four one's ? I can't say . When are they
>loaded ? I can't say !
>
>I tryed to make a search for file containing "save to" or "restore
>from" thanks to the explorer, nothing come out...
>
>I'm lost.
>
>Thx for reading,
>regards.
>JR.


Re: vfp 7 : memory file structure ? by Dan

Dan
Thu Aug 25 16:57:40 CDT 2005

OK, let's back up. If there's no SAVE TO or RESTORE FROM, this is not a mem
file. So please stop calling it that. It will help you solve your problem.

What is the exact filename/extension of this file?

Dan

jouinromain@campus.ie wrote:
> I think this file is a vfp memory file because if I erase it before to
> launch my prog, it is re-created by the prog once launched.
>
> Furthemore the program's behaviour depends of what is on this file :
> there is a change of values when I launch my program :
>
> At first time it reads the values of the last session from the file
> and store it who know where (I don't know how or where, I can't find
> a RESTORE or SAVE TO command) .
> Then it takes new info of the user (the username) and write this new
> username in the mem file.
> Later on, there is a test that check the actual username with the
> username loaded at the begining of the program. The two name no
> correspond if it's the first time the user connects himself to the
> program, and the program bug.
>
> If the user connect himself a second time, the program load the values
> from the mem file. In the mem file, there is the username writed down
> at the last connection, so the usernames will be the same, and the
> program doesn't bug.
>
> I really don't understand what is going on.
> Furthemore there are four variable on this mem file : username,
> usertype, userprog. Why these four one's ? I can't say . When are
> they loaded ? I can't say !
>
> I tryed to make a search for file containing "save to" or "restore
> from" thanks to the explorer, nothing come out...
>
> I'm lost.
>
> Thx for reading,
> regards.
> JR.



Re: vfp 7 : memory file structure ? by jouinromain

jouinromain
Thu Aug 25 18:53:16 CDT 2005

the file's extension is .mem

I've used a fileeditor to open all the file of my projects (windows
didn't like that). And on one of a FXP files I found a ref to a SAVE TO
and RESTORE FROM line of code !!!

I can't explain why but these files appears to haven't been changed
since three years (still I was using the "compile all file" functions
). I had to recreate one by one the forms and prog on my new vfp 7
version to re-compile these vfp 6 lines of code. Then all the files had
been freshly recreated and binary code correponded with line of code.

So there is no more writing on a mem file while the code didn't ask for
it.

Sorry for that disturbing experience. Thanks for your fast reactions.

Sincerely,
JR.


Re: vfp 7 : memory file structure ? by David

David
Thu Aug 25 20:25:52 CDT 2005

JR,

Do you have the source code PRG files? The one with that code should have
the same base filename. We can't really help you with how the code makes use
of the memvar save and restore.

--
df - Microsoft MVP FoxPro http://www.geocities.com/df_foxpro

<jouinromain@campus.ie> wrote in message
news:1125013996.943426.146950@o13g2000cwo.googlegroups.com...
> the file's extension is .mem
>
> I've used a fileeditor to open all the file of my projects (windows
> didn't like that). And on one of a FXP files I found a ref to a SAVE TO
> and RESTORE FROM line of code !!!
>
> I can't explain why but these files appears to haven't been changed
> since three years (still I was using the "compile all file" functions
> ). I had to recreate one by one the forms and prog on my new vfp 7
> version to re-compile these vfp 6 lines of code. Then all the files had
> been freshly recreated and binary code correponded with line of code.
>
> So there is no more writing on a mem file while the code didn't ask for
> it.
>
> Sorry for that disturbing experience. Thanks for your fast reactions.
>
> Sincerely,
> JR.
>



Re: vfp 7 : memory file structure ? by Olaf

Olaf
Fri Aug 26 02:21:00 CDT 2005

The mem file structure created by SAVE TO changed
from VFP versoin to version, so you may only RESTORE FROM
a mem file of the same vfp version.

Bye, Olaf.



Re: vfp 7 : memory file structure ? by Bernhard

Bernhard
Fri Aug 26 05:08:11 CDT 2005

HI Olaf

> The mem file structure created by SAVE TO changed
> from VFP versoin to version, so you may only RESTORE FROM
> a mem file of the same vfp version.
What makes you think so?
I don't have problems using the same MEM file with Foxpro DOS 2.5 and VFP 9 in
both directions.

Regards
Bernhard Sander

SV: vfp 7 : memory file structure ? by Anders

Anders
Fri Aug 26 05:43:16 CDT 2005

The current username could be taken from SYS(0). It could be later be
encrypted and stored in a table file, or a text file, or a memory file, and
this file could have a misleading name and/or extension.
-Anders




Den 05-08-25 23.16, i artikeln
1125004608.612557.131040@g47g2000cwa.googlegroups.com, skrev
"jouinromain@campus.ie" <jouinromain@campus.ie>:

> I think this file is a vfp memory file because if I erase it before to
> launch my prog, it is re-created by the prog once launched.
>
> Furthemore the program's behaviour depends of what is on this file :
> there is a change of values when I launch my program :
>
> At first time it reads the values of the last session from the file and
> store it who know where (I don't know how or where, I can't find a
> RESTORE or SAVE TO command) .
> Then it takes new info of the user (the username) and write this new
> username in the mem file.
> Later on, there is a test that check the actual username with the
> username loaded at the begining of the program. The two name no
> correspond if it's the first time the user connects himself to the
> program, and the program bug.
>
> If the user connect himself a second time, the program load the values
> from the mem file. In the mem file, there is the username writed down
> at the last connection, so the usernames will be the same, and the
> program doesn't bug.
>
> I really don't understand what is going on.
> Furthemore there are four variable on this mem file : username,
> usertype, userprog. Why these four one's ? I can't say . When are they
> loaded ? I can't say !
>
> I tryed to make a search for file containing "save to" or "restore
> from" thanks to the explorer, nothing come out...
>
> I'm lost.
>
> Thx for reading,
> regards.
> JR.
>


Re: vfp 7 : memory file structure ? by Olaf

Olaf
Fri Aug 26 09:28:19 CDT 2005

> What makes you think so?
> I don't have problems using the same MEM file with Foxpro DOS 2.5 and VFP 9 in both directions.
Christof Wollenhaupt aka Lange said so.
Maybe that is only true if you store certain
more complex things like arrays!?

Chris should know it, there are differences.

Bye, Olaf.



Re: vfp 7 : memory file structure ? by jouinromain

jouinromain
Fri Aug 26 12:07:41 CDT 2005

hi !

Ok, I understand now what was going on : The first time the user
entered his name, it is on a input box. This box contained white
characters, that was saved on the username. Later on when the program
checked this name, it couldn't find any user with blank characters on
the database, so it didn't display anything.

At the second time, the program get back the username from the memfile,
but on this file, the blank char had been deleted, and on the input
box there was no more blank char : value=3Dmemfile.username . So when I
select data upon the username, I could find some and display it, but
only the second time...

Yes, beginner's error you could say.

But, the tricky thing is that I had all the old user that could access
to all the data in the db. Only the new one, (who we wanted to access
only its selected info, rather than info of everyone as was the system
until now) didn't get any data. This when I only copied and paste the
forms, modifying the select query, to have only the one line to the
specific user rather than all the lines from all the db for "super
user".

So, why was it more difficult to have only one line rather than all the
db ? Why the new user could access to data only at the second time ? I
had to search through mem file and "display mem" in every part of the
code to discover than in my select query I asked for a 20 char long
string, that was displayed on screen exactly like a 10 char long
string... And that because of a mem file that stored and restored
theses values in different way than if someone would do it itself...
And how difficult was it to change this program, find where was these
line of SAVE TO and RESTORE TO... Recompile all...

In the case of the super user, there wasn't selection upon the name of
this super user, but a "select all", and then a selection of one on the
grid-list, to have the info. That worked only because there wasn't any
test on this super-user name...

Well. I'm glad you tried to help me so much, I'm ashame of this
adventure, but I've really been stucked for five days on this
problem...

But, like I say on my MSN nick today : "Los computadores no hacen nada
m=E1s que lo que les pidemos <o:)"

Thanks for everything,
regards,
JR.


Re: vfp 7 : memory file structure ? by Rick

Rick
Fri Aug 26 12:59:01 CDT 2005

Bernhard,
One big problem is if you save newer data types (DateTime, Integer, etc.) and
try to open it in FPD.

Rick

"Bernhard Sander" <fuchs@individsoft.de> wrote in message
news:uInpRYiqFHA.3780@TK2MSFTNGP10.phx.gbl...
> HI Olaf
>
>> The mem file structure created by SAVE TO changed
>> from VFP versoin to version, so you may only RESTORE FROM
>> a mem file of the same vfp version.
> What makes you think so?
> I don't have problems using the same MEM file with Foxpro DOS 2.5 and VFP 9 in
> both directions.
>
> Regards
> Bernhard Sander


Re: vfp 7 : memory file structure ? by Bernhard

Bernhard
Fri Aug 26 14:24:45 CDT 2005

Hi Rick

> Bernhard,
> One big problem is if you save newer data types (DateTime, Integer,
> etc.) and try to open it in FPD.
I'm convinced. The new types make problems. But only these.
With the common types the mem files are up and down compatible.

Thanks
Bernhard Sander