04-27-2010 05:56 AM
Hi All,
I need help related to Macros in C.
This is my code:
#ifndef checkTrace
#define checkTrace(fCall) if(1){printf("function called from checkTrace is:");}
#endif
what i am looking for is :
suppose if am calling checkTrace(getchar()); i want to print "getchar() is called from checkTrace macro".
Like this whatever the func called by checkTrace macro, i want to print the message like above mentioning the func called by checkTrace()
Please any body let me know how i can do this in CVI?
Any help will be greatly appreciated.
Thanks,
Harika
Solved! Go to Solution.
04-27-2010 06:33 AM
I think what you need is the "stringification operator" : #
Check this:
#define checkTrace(fCall) if(1){printf("function called from checkTrace is: '%s'", #fCall);}
checkTrace(getchar())