Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Read file from disk, not from exe
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Divers
Thread ID:
01414757
Message ID:
01414775
Vues:
45
>>>>I have a config.fpw included with the exe as a text file in the project/other section. In the exe I have a function that needs to read the content of another disk file, in a different folder. The disk file happens to be named config.fpw as well, yet VFP functions (FILE(), FREAD(), etc) keep reading the content of the config.fpw file from the exe, even though I pass the file name with the complete path.
>>>>There must be a way to force VFP to read the file from disk, right? TIA
>>>
>>>Nope,
>>>There is no way to force VFP to read disk file.
>>>Just change the name of the disk file.
>>*
>>Thanks Borislav. That's what I ended up doing; copied the disk file to a temp file, then read the temp. However, there's no clear way to determine if the original disk file is there, since all VFP native functions refer to the file within the exe. Therefore, COPY or RENAME have to be used within TRY ... ENTRY, or any other exception/error handling structure.
>
>O! I just remember something, but NOT sure if it will work:
>
>lcConfig = EXECSCRIPT("FILETOSTR('c:\MyFolder\Config.FPW')")
>? lcConfig
>
>NOT TESTED!!!
>
>UPDATE: I just saw that Naomi points you to a thread that it is already discussed.
*
EXECSCRIPT works! In my case, the whole block of code would have to be scripted, including IF FILE(externalFile) .... FILETOSTR(), etc.
*
Yes, Naomi's reply points to a thread that basically leads to the same conclusion; find a way to execute statements outside the executable.
Thanks again.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform