Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6638699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:28:00+00:00 2026-05-25T23:28:00+00:00

Is there any macro which will remove double quotes and ‘\0’ in a string?

  • 0

Is there any macro which will remove double quotes and ‘\0’ in a string?

For example:-
“HELLO\0” -> HELLO

Edited:-
Actually I want to get the function address. So I thought to use FUNC Macro to get the function name and stipping out double quotes and ‘\0’ will help me to get the function address.

for ex:

#define FUN_PTR fun
#define FUN_NAME "fun"
void fun(){
 printf("fun add %p name %s\n",FUN_PTR,FUN_NAME);
}

To avoid user define macros. I like to know other methods to derive these functionality :).

void fun(){
 printf("fun add %p name %s\n",<SOME_MACRO>(__FUNC__),__FUNC__);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T23:28:01+00:00Added an answer on May 25, 2026 at 11:28 pm

    Do it the other way around.

    #define PRINT_PTR(p) printf(#p " == %p\n", (void *) p)
    
    int main()
    {
        PRINT_PTR(exit);
        return 0;
    }
    

    Inside a macro, if x is a macro argument, then #x is the string version.

    #define PRINT_INT(i) printf(#i " == %d\n", i)
    PRINT_INT(5 + ~3);
    PRINT_INT(atoi("1234"));
    

    Typically, if you use this a lot, then you’ll want to define a helper function to work around the weak type system in C:

    void print_ptr_func(char const *s, int v);
    #define PRINT_PTR(p) print_ptr_func(#p, p)
    

    Note that this won’t work for getting the address of the current function. __FUNC__ is not a macro and it is not a string literal, it has no double quotes. You cannot use __FUNC__ to get the address of the function without some serious trickery, and it will break half the time. For example:

    #define PRINT_FUNC_INFO() print_func_info(__FUNC__)
    
    #include <dlfcn.h>
    void print_func_info(char const *n)
    {
        void *p = dlsym(RTLD_DEFAULT, n);
        printf("Function %s, address %p\n", n, p);
    }
    

    However, this will not work half the time — dlsym wasn’t designed to be used for that purpose.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a cross-platform C application. Is there any compiler macro which is
Calling all C macro gurus... Is there any way to write a C macro
Is there any query which can return me the number of revisions made to
Is there any efficiency difference in an explicit vs implicit inner join? For example:
I'm wondering if there's a simple way for a Word macro to determine which
Is there any way of defining macros (like tex macros o latex defines) in
Is there any way to check whether a file is locked without using a
Is there any free or commercial component written in .NET (no COM interop) that
Is there any way to capture the MouseDown even from the .NET 2.0 TextBox
Is there any difference between int on_exit(void (*function)(int , void *), void *arg); and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.