samrajput1143 / cpp

0 stars 0 forks source link

lol #1

Open samrajput1143 opened 10 months ago

samrajput1143 commented 10 months ago

// Macros to be used by xapp users

define USR_LOG_EMERG(comp_name, fmt, ...) \

create_log(0, 1, EMERG, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

define USR_LOG_ALERT(comp_name, fmt, ...) \

create_log(0, 1, ALERT, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

define USR_LOG_CRIT(comp_name, fmt, ...) \

create_log(0, 1, CRIT, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

define USR_LOG_ERROR(comp_name, fmt, ...) \

create_log(0, 1, ERROR, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

define USR_LOG_WARNING(comp_name, fmt, ...) \

create_log(0, 1, WARNING, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

define USR_LOG_NOTICE(comp_name, fmt, ...) \

create_log(0, 1, NOTICE, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

define USR_LOG_INFO(comp_name, fmt, ...) \

create_log(0, 1, INFO, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

define USR_LOG_DEBUG(comp_name, fmt, ...) \

create_log(0, 1, DEBUG, comp_name, FILE, LINE, fmt, ##__VA_ARGS__)

samrajput1143 commented 10 months ago

define XAPP_SUBS "XAPP_SUBS"

define XAPP_CTRL "XAPP_CTRL"

define XAPP_IND "XAPP_IND"

define XAPP_METRICS "XAPP_METRICS"

define XAPP_MAIN "XAPP_MAIN"

define XAPP_RSVD1 "XAPP_RSVD1"

define XAPP_RSVD2 "XAPP_RSVD2"

define XAPP_RSVD3 "XAPP_RSVD3"

define XAPP_RSVD4 "XAPP_RSVD4"

define XAPP_RSVD5 "XAPP_RSVD5"

define XAPP_E2SM_RC "XAPP_E2SM_RC"

define XAPP_E2SM_KPM "XAPP_E2SM_KPM"

//List of supported xApp comp names

define XAPP_LOGDBG_COMP (const char*[]){XAPP_SUBS, XAPP_CTRL, XAPP_IND, XAPP_METRICS, \

                      XAPP_MAIN, XAPP_RSVD1, XAPP_RSVD2, XAPP_RSVD3, \
                      XAPP_RSVD4, XAPP_RSVD5, XAPP_E2SM_RC, XAPP_E2SM_KPM}
samrajput1143 commented 10 months ago

// Online C compiler to run C program online

include

define userlog(fmt,..) printtoconsloe(fmt,FILE,LINE,##__VA_ARGS__)

void printtoconsloe(const char fmt,const char file, int line,..){ printf("%s %d %s ",file,line,fmt); } int main() { // Write C code here

return 0;

}

getting error

ERROR! gcc /tmp/IueePtgGPl.c -lm /tmp/IueePtgGPl.c:3:21: error: expected parameter name, found "." 3 #define userlog(fmt,..) printtoconsloe(fmt,FILE,LINE,##__VA_ARGS__)
samrajput1143 commented 10 months ago
#include <stdio.h>

#define userlog2(fmt,...) printtoconsloe2(fmt,##__VA_ARGS__)
void printtoconsloe2(const char * fmt,...){
    printf(fmt);
}

int main() {
    // Write C code here

    userlog2("lol",2,9.0,"kumar");

    return 0;
}

how to access and print the arguments (that is 2,9.0,"kumar")we have passed in userlog2 . we are able to print lol but not rest of the arguments