Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

#IF .. #ENDIF PROBLEM

Status
Not open for further replies.

DannC

Programmer
Apr 5, 2001
75
RO
Hi,

I have a header file called eco_user.H wich contains this code

#Define userCh filetostr('ex.txt')

#if userCh='o'
#Define cstMsg "one"
#ELSE
#ELIF userCh='b'
#DEFINE cstMsg "TWO"
#endif


Everything works fine, but Vfp being something betw complier and interpreter does not change the the cstMsg until i recompile the source code. My question is when i launch this from a exe file it will work.
EX: If the content of ex.txt is 'o' the cstMsh should be one else two. Thank's.


The second one:

Does Microsoft develop another version of Vfp and where I can ask how the hell i protect my apps from Refox (this is a big problem...).

Again, thank's for your support.
 
Your named constant is only evaluated when compiled and after that it is not re-evaluated again (untill you recompile it again, of course).

So once you created an exe, it is not evaluated anymore.
So your #define is totally dependent on the environment in which you compile your sources.

HTH,
Weedz (Wietze Veld)
veld4663@exact.nl
The Netherlands

They cling emotionally to code and fix development rather than choosing practices based on analytical assesments of what works best.

After the GoldRush - Steve McConnell
 
As Weedz said, the header file is included into the source code at the time of compilation. So yes, you will have to recompile the source if you change the header contents, in order for the changes to be apparent to the program.

If the content of ex.txt is 'o' the cstMsh should be one else two.

Remove the elseif, as follows:

#if userCh='o'
#Define cstMsg "one"
#ELSE
#DEFINE cstMsg "TWO"
#endif

In regards to you second question, I'm not quite sure I understand it. Yes, there is a VFP7 releasing soon. Jon Hawkins

The World Is Headed For Mutiny,
When All We Want Is Unity. - Creed
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top