You are here:

C/demo versions

Advertisement


Question


hello sir

i would like to know about demo verions . and make this ques clear ?
Q:------>
How are portions of a program disabled in demo versions?
ANS----->
  If you are distributing a demo version of your program, the preprocessor can be used to enable or disable portions of your program. The following portion of code shows how this task is accomplished, using the preprocessor directives #if and #endif:

int save_document(char* doc_name)
{
#if DEMO_VERSION
printf(“Sorry! You can’t save documents using the DEMO version of this program!n”);
return(0);
#endif
...
}

thank you
monika

Answer
If they are doing using a #if condition variable,
then you cannot do anything to overcome that in an executable.
The reason is, executable is a compiled code.
That means, preprocessor part is long over.

So, only way left is for you to get the source code and recompile.

For defining or undefining the value of DEMO_VERSION, you can use the compiler itself.
You can pass the value during compilation.

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.