这篇教程C++ vprintf函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中vprintf函数的典型用法代码示例。如果您正苦于以下问题:C++ vprintf函数的具体用法?C++ vprintf怎么用?C++ vprintf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了vprintf函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: v4pDisplayDebugvoid v4pDisplayDebug(char *formatString, ...) { va_list args ; char text[0x100] ; va_start(args, formatString) ; vprintf(formatString, args) ; va_end(args);}
开发者ID:miellaby,项目名称:v4p,代码行数:6,
示例2: __show_messagestatic int __show_message(enum msg_type flag, const char *string, va_list ap){ // _ShowMessage MUST be used instead of printf as of 10/24/2004. // Return: 0 = Successful, 1 = Failed.// int ret = 0; char prefix[40]; if (!string || strlen(string) <= 0) { printf("Empty string passed to _ShowMessage()./n"); return 1; } switch (flag) { case MSG_NONE: // direct printf replacement break; case MSG_STATUS: //Bright Green (To inform about good things) strcpy(prefix,CL_GREEN"[Status]"CL_RESET":"); break; case MSG_SQL: //Bright Violet (For dumping out anything related with SQL) strcpy(prefix,CL_MAGENTA"[SQL]"CL_RESET":"); break; case MSG_FATAL: //Bright Red (Fatal errors, abort(); if possible) strcpy(prefix,CL_RED"[Fatal Error]"CL_RESET":"); break; case MSG_ERROR: //Bright Red (Regular errors) strcpy(prefix,CL_RED"[Error]"CL_RESET":"); break; case MSG_WARN: //Bright Yellow strcpy(prefix,CL_YELLOW"[Warning]"CL_RESET":"); break; case MSG_NOTICE: //Bright White (Less than a warning) strcpy(prefix,CL_WHITE"[Notice]"CL_RESET":"); break; case MSG_INFO: //Bright White (Variable information) strcpy(prefix,CL_WHITE"[Info]"CL_RESET":"); break; case MSG_DEBUG: //Bright Cyan, important stuff! strcpy(prefix,CL_CYAN"[Debug]"CL_RESET":"); break; default: printf("In function _ShowMessage() -> Invalid flag passed./n"); return 1; } if (flag <= msglevel) { if (flag != MSG_NONE) printf ("%s ", prefix); vprintf (string, ap); fflush (stdout); } va_end(ap);/* if ((core_config.debug_output_level > -1) && (flag >= core_config.debug_output_level)) { FILE *fp; fp=fopen(OUTPUT_MESSAGES_LOG,"a"); if (fp == NULL) { printf(CL_RED"[Error]"CL_RESET": Could not open '"CL_WHITE"%s"CL_RESET"', file not found./n",OUTPUT_MESSAGES_LOG); fflush(stdout); return; } StripColor(output); strcpy(output,"/r"); fwrite(output,strlen(output),1,fp); fclose(fp); }*/ return 0;}
开发者ID:yiend,项目名称:mnn,代码行数:68,
示例3: mk_utils_tracevoid mk_utils_trace(const char *component, int color, const char *function, char *file, int line, const char* format, ...){ va_list args; char *color_function = NULL; char *color_fileline = NULL; char *color_component = NULL; char *reset_color = ANSI_RESET; char *magenta_color = ANSI_RESET ANSI_BOLD_MAGENTA; char *red_color = ANSI_RESET ANSI_BOLD_RED; char *cyan_color = ANSI_RESET ANSI_CYAN; struct timeval tv; struct timezone tz; if (env_trace_filter) { if (!strstr(env_trace_filter, file)) { return; } } /* Mutex lock */ pthread_mutex_lock(&mutex_trace); gettimeofday(&tv, &tz); /* Switch message color */ char* bgcolortype = mk_utils_getenv("MK_TRACE_BACKGROUND"); if (!bgcolortype) { bgcolortype = "dark"; } if (!strcmp(bgcolortype, "light")) { switch(color) { case MK_TRACE_CORE: color_component = ANSI_BOLD_GREEN; color_function = ANSI_BOLD_MAGENTA; color_fileline = ANSI_GREEN; break; case MK_TRACE_PLUGIN: color_component = ANSI_BOLD_GREEN; color_function = ANSI_BLUE; color_fileline = ANSI_GREEN; break; } } else { /* covering 'dark' and garbage values defaulting to 'dark' cases */ switch(color) { case MK_TRACE_CORE: color_component = ANSI_BOLD_GREEN; color_function = ANSI_YELLOW; color_fileline = ANSI_BOLD_WHITE; break; case MK_TRACE_PLUGIN: color_component = ANSI_BOLD_BLUE; color_function = ANSI_BLUE; color_fileline = ANSI_BOLD_WHITE; break; } } /* Only print colors to a terminal */ if (!isatty(STDOUT_FILENO)) { color_function = ""; color_fileline = ""; reset_color = ""; magenta_color = ""; red_color = ""; cyan_color = ""; } va_start( args, format ); printf("~ %s%2lu.%lu%s %s[%s%s%s|%s:%-3i%s] %s%s()%s ", cyan_color, (tv.tv_sec - monkey_init_time), tv.tv_usec, reset_color, magenta_color, color_component, component, color_fileline, file, line, magenta_color, color_function, function, red_color); vprintf(format, args ); va_end(args); printf("%s/n", reset_color); fflush(stdout); /* Mutex unlock */ pthread_mutex_unlock(&mutex_trace);}
开发者ID:iamaeternus,项目名称:monkey,代码行数:89,
示例4: conf_default_message_callbackstatic void conf_default_message_callback(const char *fmt, va_list ap){ printf("#/n# "); vprintf(fmt, ap); printf("/n#/n");}
开发者ID:whble,项目名称:trunk,代码行数:6,
示例5: vsim_info_contstatic void vsim_info_cont(const char fmt[], va_list ap) { if (verbose < 1) return; fgreen(); vprintf(fmt, ap); fbreset();}
开发者ID:C-o-r-E,项目名称:Teacup_Firmware,代码行数:6,
示例6: Sys_VPrintfvoid Sys_VPrintf(const char *msg, va_list arg) { tty_Hide(); vprintf(msg, arg); tty_Show();}
开发者ID:iodoom-gitorious,项目名称:pvs-dhewg,代码行数:5,
示例7: setLogFilevoid setLogFile(const char *fileName) { if (fileName == NULL) { return; } if (strlen(fileName) == 0) { return; } if (strlen(fileName) > MAX_LOG_FILE_NAME_LEN - 1) { printf("too long file name:%d/n",strlen(fileName)); return; } { FILE *f = NULL;#if __IS_WIN__ if ((fopen_s(&f,fileName,"rw")) != 0) {#else if ((f = fopen(fileName,"rw")) == NULL) {#endif printf("open log file [%s] error/n",fileName); return; } fclose(f);#if __IS_WIN__ strncpy_s(logFileName,MAX_LOG_FILE_NAME_LEN,fileName,strlen(fileName));#else strncpy(logFileName,fileName,MAX_LOG_FILE_NAME_LEN);#endif }}void printLog(char* sModule, int nLogLevel, char *sFile,int nLine,char *fmt, ...){ struct tm newTimeST;#if __IS_WIN__ DWORD nThreadID; #else unsigned int nThreadID;#endif struct tm *newtime = &newTimeST; time_t aclock; FILE *logFile = NULL; va_list ap1, ap2;; if (nLogLevel < 1 || nLogLevel > COUNT_ERROR_LEVEL) { printf("error log level:%d/n",nLogLevel); return; } if (nLogLevel > logLevel) { return; } time( &aclock ); #if __IS_WIN__ localtime_s(newtime, &aclock ); nThreadID = GetCurrentProcessId(); nThreadID = (nThreadID << 16) + GetCurrentThreadId();#else newtime = localtime( &aclock ); nThreadID = getpid(); nThreadID = (nThreadID << 16) + pthread_self();#endif if (strlen(logFileName) > 0) {#if __IS_WIN__ if ((fopen_s(&logFile,logFileName,"rb+")) != 0) {#else if ((logFile = fopen(logFileName,"rb+")) == NULL) {#endif printf("open log file [%s] error/n",logFileName); } } printf("/n[%4d-%02d-%02d %02d:%02d:%02d][%s][%ud][%s:%d][%s] ", newtime->tm_year+1900,newtime->tm_mon+1,newtime->tm_mday,newtime->tm_hour, newtime->tm_min,newtime->tm_sec,sModule,nThreadID,sFile,nLine,errorLevel[nLogLevel-1]); va_start(ap1, fmt); if (logFile != NULL) {#if __IS_WIN__ ap2 = ap1;#else va_copy(ap2, ap1);#endif vfprintf(logFile,fmt,ap2); } vprintf(fmt,ap1); if (logFile != NULL) { va_end(ap2); } va_end(ap1);}int errorReturn(int errorCode,char *tag,char *msg){ LOG_WITH_TAG(LEVEL_ERROR,tag,errorCode,msg); return errorCode;}
开发者ID:mbigger,项目名称:shmdb,代码行数:99,
示例8: ath_hal_vprintfvoidath_hal_vprintf(struct ath_hal *ah, const char* fmt, va_list ap){ vprintf(fmt, ap);}
开发者ID:dcui,项目名称:FreeBSD-9.3_kernel,代码行数:5,
示例9: printfint printf(const char *format, ...) { va_list va; va_start(va, format); return vprintf(format, va);}
开发者ID:CyberGrandChallenge,项目名称:samples,代码行数:5,
示例10: printf_info/* * for GalUtil_PInfo1, GalUtil_PInfo2, GalUtil_Debug1, GalUtil_Debug2 */static void printf_info(const char *format, va_list args, void *client_data){ vprintf(format, args); fflush(stdout);}
开发者ID:junion,项目名称:GalaxyWinPython,代码行数:8,
示例11: VFLogvvoid VFLogv(const char* format, va_list args){ vprintf(format, args);}
开发者ID:tearsofphoenix,项目名称:VeritasKit,代码行数:4,
示例12: va_startvoid LocalConsole::Write(const char * Format, ...){ va_list ap; va_start(ap, Format); vprintf(Format, ap);}
开发者ID:SkyFire,项目名称:sandshroud,代码行数:6,
示例13: nandsim_logvoidnandsim_log(struct nandsim_chip *chip, int level, const char *fmt, ...){ char hdr[TIME_STR_SIZE]; char tmp[NANDSIM_ENTRY_SIZE]; struct nandsim_softc *sc; struct timeval currtime; va_list ap; int hdr_len, len, rest; if (nandsim_log_output == NANDSIM_OUTPUT_NONE) return; if (chip == NULL) return; sc = chip->sc; if (!sc->alq && nandsim_log_output == NANDSIM_OUTPUT_FILE) return; if (level <= nandsim_log_level) { microtime(&currtime); hdr_len = sprintf(hdr, "%08jd.%08li [chip:%d, ctrl:%d]: ", (intmax_t)currtime.tv_sec, currtime.tv_usec, chip->chip_num, chip->ctrl_num); switch(nandsim_log_output) { case NANDSIM_OUTPUT_CONSOLE: printf("%s", hdr); va_start(ap, fmt); vprintf(fmt, ap); va_end(ap); break; case NANDSIM_OUTPUT_RAM: va_start(ap, fmt); len = vsnprintf(tmp, NANDSIM_ENTRY_SIZE - 1, fmt, ap); tmp[NANDSIM_ENTRY_SIZE - 1] = 0; va_end(ap); rest = log_size - sc->log_idx - 1; if (rest >= hdr_len) { bcopy(hdr, &sc->log_buff[sc->log_idx], hdr_len); sc->log_idx += hdr_len; sc->log_buff[sc->log_idx] = 0; } else { bcopy(hdr, &sc->log_buff[sc->log_idx], rest); bcopy(&hdr[rest], sc->log_buff, hdr_len - rest); sc->log_idx = hdr_len - rest; sc->log_buff[sc->log_idx] = 0; } rest = log_size - sc->log_idx - 1; if (rest >= len) { bcopy(tmp, &sc->log_buff[sc->log_idx], len); sc->log_idx += len; sc->log_buff[sc->log_idx] = 0; } else { bcopy(tmp, &sc->log_buff[sc->log_idx], rest); bcopy(&tmp[rest], sc->log_buff, len - rest); sc->log_idx = len - rest; sc->log_buff[sc->log_idx] = 0; } break; case NANDSIM_OUTPUT_FILE: va_start(ap, fmt); len = vsnprintf(tmp, NANDSIM_ENTRY_SIZE - 1, fmt, ap); tmp[NANDSIM_ENTRY_SIZE - 1] = 0; va_end(ap); rest = NANDSIM_ENTRY_SIZE - str_index; if (rest >= hdr_len) { strcat(string, hdr); str_index += hdr_len; } else { strlcat(string, hdr, NANDSIM_ENTRY_SIZE + 1); alq_write(sc->alq, (void *) string, ALQ_NOWAIT); strcpy(string, &hdr[rest]); str_index = hdr_len - rest; } rest = NANDSIM_ENTRY_SIZE - str_index; if (rest >= len) { strcat(string, tmp); str_index += len; } else { strlcat(string, tmp, NANDSIM_ENTRY_SIZE + 1); alq_write(sc->alq, (void *) string, ALQ_NOWAIT); strcpy(string, &tmp[rest]); str_index = len - rest; } break; default: break; } }//.........这里部分代码省略.........
开发者ID:coyizumi,项目名称:cs111,代码行数:101,
示例14: panicsys//.........这里部分代码省略......... /* * Lower ipl to 10 to keep clock() from running, but allow * keyboard interrupts to enter the debugger. These callbacks * are executed with panicstr set so they can bypass locks. */ splx(ipltospl(CLOCK_LEVEL)); panic_quiesce_hw(pdp); (void) FTRACE_STOP(); (void) callb_execute_class(CB_CL_PANIC, NULL); if (log_intrq != NULL) log_flushq(log_intrq); /* * If log_consq has been initialized and syslogd has started, * print any messages in log_consq that haven't been consumed. */ if (log_consq != NULL && log_consq != log_backlogq) log_printq(log_consq); fm_banner();#if defined(__x86) /* * A hypervisor panic originates outside of Solaris, so we * don't want to prepend the panic message with misleading * pointers from within Solaris. */ if (!IN_XPV_PANIC())#endif printf("/n/rpanic[cpu%d]/thread=%p: ", cp->cpu_id, (void *)t); vprintf(format, alist); printf("/n/n"); if (t->t_panic_trap != NULL) { panic_showtrap(t->t_panic_trap); printf("/n"); } traceregs(rp); printf("/n"); if (((boothowto & RB_DEBUG) || obpdebug) && !nopanicdebug && !panic_forced) { if (dumpvp != NULL) { debug_enter("panic: entering debugger " "(continue to save dump)"); } else { debug_enter("panic: entering debugger " "(no dump device, continue to reboot)"); } } } else if (panic_dump != 0 || panic_sync != 0 || panicstr != NULL) { printf("/n/rpanic[cpu%d]/thread=%p: ", cp->cpu_id, (void *)t); vprintf(format, alist); printf("/n"); } else goto spin; /* * Prior to performing sync or dump, we make sure that do_polled_io is * set, but we'll leave ipl at 10; deadman(), a CY_HIGH_LEVEL cyclic, * will re-enter panic if we are not making progress with sync or dump.
开发者ID:MatiasNAmendola,项目名称:AuroraUX-SunOS,代码行数:67,
示例15: initsymtable/* * Initialize a symbol table from a file */voidinitsymtable(char *filename){ char *base; long tblsize; struct entry *ep; struct entry *baseep, *lep; struct symtableheader hdr; struct stat stbuf; long i; int fd; vprintf(stdout, "Initialize symbol table./n"); if (filename == NULL) { entrytblsize = maxino / HASHFACTOR; entry = (struct entry **) calloc((unsigned)entrytblsize, sizeof(struct entry *)); if (entry == (struct entry **)NULL) panic("no memory for entry table/n"); ep = addentry(".", ROOTINO, NODE); ep->e_flags |= NEW; return; } if ((fd = open(filename, O_RDONLY, 0)) < 0) { fprintf(stderr, "open: %s/n", strerror(errno)); panic("cannot open symbol table file %s/n", filename); } if (fstat(fd, &stbuf) < 0) { fprintf(stderr, "stat: %s/n", strerror(errno)); panic("cannot stat symbol table file %s/n", filename); } tblsize = stbuf.st_size - sizeof(struct symtableheader); base = calloc(sizeof(char), (unsigned)tblsize); if (base == NULL) panic("cannot allocate space for symbol table/n"); if (read(fd, base, (int)tblsize) < 0 || read(fd, (char *)&hdr, sizeof(struct symtableheader)) < 0) { fprintf(stderr, "read: %s/n", strerror(errno)); panic("cannot read symbol table file %s/n", filename); } switch (command) { case 'r': /* * For normal continuation, insure that we are using * the next incremental tape */ if (hdr.dumpdate != dumptime) { if (hdr.dumpdate < dumptime) fprintf(stderr, "Incremental tape too low/n"); else fprintf(stderr, "Incremental tape too high/n"); done(1); } break; case 'R': /* * For restart, insure that we are using the same tape */ curfile.action = SKIP; dumptime = hdr.dumptime; dumpdate = hdr.dumpdate; if (!bflag) newtapebuf(hdr.ntrec); getvol(hdr.volno); break; default: panic("initsymtable called from command %c/n", command); break; } maxino = hdr.maxino; entrytblsize = hdr.entrytblsize; entry = (struct entry **) (base + tblsize - (entrytblsize * sizeof(struct entry *))); baseep = (struct entry *)(base + hdr.stringsize - sizeof(struct entry)); lep = (struct entry *)entry; for (i = 0; i < entrytblsize; i++) { if (entry[i] == NULL) continue; entry[i] = &baseep[(long)entry[i]]; } for (ep = &baseep[1]; ep < lep; ep++) { ep->e_name = base + (long)ep->e_name; ep->e_parent = &baseep[(long)ep->e_parent]; if (ep->e_sibling != NULL) ep->e_sibling = &baseep[(long)ep->e_sibling]; if (ep->e_links != NULL) ep->e_links = &baseep[(long)ep->e_links]; if (ep->e_entries != NULL) ep->e_entries = &baseep[(long)ep->e_entries]; if (ep->e_next != NULL) ep->e_next = &baseep[(long)ep->e_next]; }}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:96,
示例16: vlog/* * Logs the given message to stdout (if print is true) while prefixing the * current time to it. Additionally, the message will be saved in the i3 SHM * log if enabled. * This is to be called by *LOG() which includes filename/linenumber/function. * */static void vlog(const bool print, const char *fmt, va_list args) { /* Precisely one page to not consume too much memory but to hold enough * data to be useful. */ static char message[4096]; static struct tm result; static time_t t; static struct tm *tmp; static size_t len; /* Get current time */ t = time(NULL); /* Convert time to local time (determined by the locale) */ tmp = localtime_r(&t, &result); /* Generate time prefix */ len = strftime(message, sizeof(message), "%x %X - ", tmp); /* * logbuffer print * ---------------- * true true format message, save, print * true false format message, save * false true print message only * false false INVALID, never called */ if (!logbuffer) {#ifdef DEBUG_TIMING struct timeval tv; gettimeofday(&tv, NULL); printf("%s%d.%d - ", message, tv.tv_sec, tv.tv_usec);#else printf("%s", message);#endif vprintf(fmt, args); } else { len += vsnprintf(message + len, sizeof(message) - len, fmt, args); if (len >= sizeof(message)) { fprintf(stderr, "BUG: single log message > 4k/n"); /* vsnprintf returns the number of bytes that *would have been written*, * not the actual amount written. Thus, limit len to sizeof(message) to avoid * memory corruption and outputting garbage later. */ len = sizeof(message); /* Punch in a newline so the next log message is not dangling at * the end of the truncated message. */ message[len - 2] = '/n'; } /* If there is no space for the current message in the ringbuffer, we * need to wrap and write to the beginning again. */ if (len >= (size_t)(logbuffer_size - (logwalk - logbuffer))) { loglastwrap = logwalk; logwalk = logbuffer + sizeof(i3_shmlog_header); store_log_markers(); header->wrap_count++; } /* Copy the buffer, move the write pointer to the byte after our * current message. */ strncpy(logwalk, message, len); logwalk += len; store_log_markers();#if !defined(__OpenBSD__) /* Wake up all (i3-dump-log) processes waiting for condvar. */ pthread_cond_broadcast(&(header->condvar));#endif if (print) fwrite(message, len, 1, stdout); }}
开发者ID:bsmr-i3,项目名称:i3,代码行数:80,
示例17: Sys_DebugVPrintfvoid Sys_DebugVPrintf( const char *fmt, va_list arg ) { tty_Hide(); vprintf( fmt, arg ); tty_Show();}
开发者ID:iodoom-gitorious,项目名称:pvs-dhewg,代码行数:5,
示例18: msgvoid msg(const char *fmt, ...) { va_list va; va_start(va, fmt); vprintf(fmt, va); va_end(va);}
开发者ID:shunting1986,项目名称:scc,代码行数:6,
示例19: printf_wrappervoid printf_wrapper(void *env, const char *fmt, ...) { va_list args; va_start(args, fmt); vprintf(fmt, args); va_end(args);}
开发者ID:xbe,项目名称:micropython,代码行数:6,
示例20: test1void test1(va_list args) { vprintf("%d %f %ld %c %s %% %x %X %i/n", args); }
开发者ID:jakre,项目名称:sulong,代码行数:1,
示例21: vpanicvoidvpanic(const char *fmt, va_list ap){#ifdef SMP cpuset_t other_cpus;#endif struct thread *td = curthread; int bootopt, newpanic; static char buf[256]; spinlock_enter();#ifdef SMP /* * stop_cpus_hard(other_cpus) should prevent multiple CPUs from * concurrently entering panic. Only the winner will proceed * further. */ if (panicstr == NULL && !kdb_active) { other_cpus = all_cpus; CPU_CLR(PCPU_GET(cpuid), &other_cpus); stop_cpus_hard(other_cpus); } /* * Ensure that the scheduler is stopped while panicking, even if panic * has been entered from kdb. */ td->td_stopsched = 1;#endif bootopt = RB_AUTOBOOT; newpanic = 0; if (panicstr) bootopt |= RB_NOSYNC; else { bootopt |= RB_DUMP; panicstr = fmt; newpanic = 1; } if (newpanic) { (void)vsnprintf(buf, sizeof(buf), fmt, ap); panicstr = buf; cngrab(); printf("panic: %s/n", buf); } else { printf("panic: "); vprintf(fmt, ap); printf("/n"); }#ifdef SMP printf("cpuid = %d/n", PCPU_GET(cpuid));#endif#ifdef KDB if (newpanic && trace_on_panic) kdb_backtrace(); if (debugger_on_panic) kdb_enter(KDB_WHY_PANIC, "panic");#endif /*thread_lock(td); */ td->td_flags |= TDF_INPANIC; /* thread_unlock(td); */ if (!sync_on_panic) bootopt |= RB_NOSYNC; kern_reboot(bootopt);}
开发者ID:niuzhenlin,项目名称:freebsd,代码行数:68,
示例22: RARCH_LOG_Vvoid RARCH_LOG_V(const char *tag, const char *fmt, va_list ap){#if TARGET_OS_IPHONE static int asl_initialized = 0;#if !TARGET_IPHONE_SIMULATORstatic aslclient asl_client;#endif#else FILE *fp = NULL; (void)fp;#endif if (!verbosity_is_enabled()) return;#if TARGET_OS_IPHONE#if TARGET_IPHONE_SIMULATOR vprintf(fmt, ap);#else if (!asl_initialized) { asl_client = asl_open(file_path_str(FILE_PATH_PROGRAM_NAME), "com.apple.console", ASL_OPT_STDERR | ASL_OPT_NO_DELAY); asl_initialized = 1; } aslmsg msg = asl_new(ASL_TYPE_MSG); asl_set(msg, ASL_KEY_READ_UID, "-1"); if (tag) asl_log(asl_client, msg, ASL_LEVEL_NOTICE, "%s", tag); asl_vlog(asl_client, msg, ASL_LEVEL_NOTICE, fmt, ap); asl_free(msg);#endif#elif defined(_XBOX1) /* FIXME: Using arbitrary string as fmt argument is unsafe. */ char msg_new[1024]; char buffer[1024]; msg_new[0] = buffer[0] = '/0'; snprintf(msg_new, sizeof(msg_new), "%s: %s %s", file_path_str(FILE_PATH_PROGRAM_NAME), tag ? tag : "", fmt); wvsprintf(buffer, msg_new, ap); OutputDebugStringA(buffer);#elif defined(ANDROID) int prio = ANDROID_LOG_INFO; if (tag) { if (string_is_equal(file_path_str(FILE_PATH_LOG_WARN), tag)) prio = ANDROID_LOG_WARN; else if (string_is_equal(file_path_str(FILE_PATH_LOG_ERROR), tag)) prio = ANDROID_LOG_ERROR; } __android_log_vprint(prio, file_path_str(FILE_PATH_PROGRAM_NAME), fmt, ap);#else#ifdef HAVE_FILE_LOGGER fp = (FILE*)retro_main_log_file();#else fp = stderr;#endif fprintf(fp, "%s %s :: ", file_path_str(FILE_PATH_PROGRAM_NAME), tag ? tag : file_path_str(FILE_PATH_LOG_INFO)); vfprintf(fp, fmt, ap); fflush(fp);#endif}
开发者ID:arakerlu,项目名称:RetroArch,代码行数:69,
示例23: infovoid info (const char*fmt, ...) { va_list ap; va_start(ap,fmt); printf("[INFO]: "); vprintf(fmt,ap);}
开发者ID:NASARace,项目名称:race,代码行数:6,
示例24: fatalvoid fatal(char* s,...){ va_list p; va_start(p,s); vprintf(s,p); va_end(p); err_print(""); /* print reason and location of fatal stop */ history=fatal_message; wrap_up();}
开发者ID:nailbiter,项目名称:atlasofliegroups,代码行数:6,
示例25: auto_trace/** Tracer */void auto_trace(char *format, ...) { va_list args; va_start(args, format); vprintf(format, args); va_end(args);}
开发者ID:shadowmint,项目名称:moai-lua-tests,代码行数:7,
示例26: printvoid print(char* s,...){ va_list p; va_start(p,s); if (term_line_empty && *s=='/n') ++s; /* avoid printing empty line */ vprintf(s,p); va_end(p); /* print formatted value */ term_line_empty= s[strlen(s)-1]=='/n'; update_terminal();}
开发者ID:nailbiter,项目名称:atlasofliegroups,代码行数:6,
示例27: test_okinttest_ok(int passed, const char *description, const char *directive, const char *reason, const char *file, unsigned line, const char *fmt, ...){ int is_todo = !passed && directive && !strcmp(directive, "TODO"); int is_setup = directive && !is_todo && !strcmp(directive, "SETUP"); if (is_setup) { if (!passed) { fflush(stdout); fprintf(stderr, "# SETUP not ok%s%s%s%s/n", description ? " - " : "", description ? description : "", reason ? " - " : "", reason ? reason : ""); } } else { if (!test_cases) { atexit(test_plan_exit); fprintf(stderr, "You tried to run a test without a plan! " "Gotta have a plan. at %s line %u/n", file, line); fflush(stderr); exit(255); } ++test_num; if (test_num > test_cases || (!passed && !is_todo)) ++test_fails; /* We dont need to print this unless we want to */#if 0 fprintf(stderr, "%s:%u: note: %sok %d%s%s%s%s%s%s/n", file, line, passed ? "" : "not ", test_num, description ? " - " : "", description ? description : "", directive ? " # " : "", directive ? directive : "", reason ? " " : "", reason ? reason : "");#endif } if (passed) fflush(stdout); else { va_list args; va_start(args, fmt); if (is_todo) { /* Enable this to output TODO as warning */#if 0 printf("%s:%d: warning: Failed (TODO) test/n", file, line); if (fmt) vprintf(fmt, args);#endif fflush(stdout); } else { fflush(stdout); fprintf(stderr, "%s:%d: error: Failed test/n", file, line); if (fmt) vfprintf(stderr, fmt, args); fflush(stderr); } va_end(args); } return passed;}
开发者ID:Apple-FOSS-Mirror,项目名称:CommonCrypto,代码行数:78,
示例28: dumpsymtable/* * dump a snapshot of the symbol table */voiddumpsymtable(char *filename, long checkpt){ struct entry *ep, *tep; ino_t i; struct entry temp, *tentry; long mynum = 1, stroff = 0; FILE *fd; struct symtableheader hdr; vprintf(stdout, "Checkpointing the restore/n"); if (Nflag) return; if ((fd = fopen(filename, "w")) == NULL) { fprintf(stderr, "fopen: %s/n", strerror(errno)); panic("cannot create save file %s for symbol table/n", filename); done(1); } clearerr(fd); /* * Assign indices to each entry * Write out the string entries */ for (i = WINO; i <= maxino; i++) { for (ep = lookupino(i); ep != NULL; ep = ep->e_links) { ep->e_index = mynum++; (void) fwrite(ep->e_name, sizeof(char), (int)allocsize(ep->e_namlen), fd); } } /* * Convert pointers to indexes, and output */ tep = &temp; stroff = 0; for (i = WINO; i <= maxino; i++) { for (ep = lookupino(i); ep != NULL; ep = ep->e_links) { memmove(tep, ep, (long)sizeof(struct entry)); tep->e_name = (char *)stroff; stroff += allocsize(ep->e_namlen); tep->e_parent = (struct entry *)ep->e_parent->e_index; if (ep->e_links != NULL) tep->e_links = (struct entry *)ep->e_links->e_index; if (ep->e_sibling != NULL) tep->e_sibling = (struct entry *)ep->e_sibling->e_index; if (ep->e_entries != NULL) tep->e_entries = (struct entry *)ep->e_entries->e_index; if (ep->e_next != NULL) tep->e_next = (struct entry *)ep->e_next->e_index; (void) fwrite((char *)tep, sizeof(struct entry), 1, fd); } } /* * Convert entry pointers to indexes, and output */ for (i = 0; i < entrytblsize; i++) { if (entry[i] == NULL) tentry = NULL; else tentry = (struct entry *)entry[i]->e_index; (void) fwrite((char *)&tentry, sizeof(struct entry *), 1, fd); } hdr.volno = checkpt; hdr.maxino = maxino; hdr.entrytblsize = entrytblsize; hdr.stringsize = stroff; hdr.dumptime = dumptime; hdr.dumpdate = dumpdate; hdr.ntrec = ntrec; (void) fwrite((char *)&hdr, sizeof(struct symtableheader), 1, fd); if (ferror(fd)) { fprintf(stderr, "fwrite: %s/n", strerror(errno)); panic("output error to file %s writing symbol table/n", filename); } (void) fclose(fd);}
开发者ID:AhmadTux,项目名称:freebsd,代码行数:85,
示例29: mk_printvoid mk_print(int type, const char *format, ...){ time_t now; struct tm *current; const char *header_color = NULL; const char *header_title = NULL; const char *bold_color = ANSI_BOLD; const char *reset_color = ANSI_RESET; const char *white_color = ANSI_WHITE; va_list args; va_start(args, format); switch (type) { case MK_INFO: header_title = "Info"; header_color = ANSI_GREEN; break; case MK_ERR: header_title = "Error"; header_color = ANSI_RED; break; case MK_WARN: header_title = "Warning"; header_color = ANSI_YELLOW; break; case MK_BUG:#ifdef DEBUG mk_utils_stacktrace();#endif header_title = " BUG !"; header_color = ANSI_BOLD ANSI_RED; break; } /* Only print colors to a terminal */ if (!isatty(STDOUT_FILENO)) { header_color = ""; bold_color = ""; reset_color = ""; white_color = ""; } now = time(NULL); struct tm result; current = localtime_r(&now, &result); printf("%s[%s%i/%02i/%02i %02i:%02i:%02i%s]%s ", bold_color, reset_color, current->tm_year + 1900, current->tm_mon + 1, current->tm_mday, current->tm_hour, current->tm_min, current->tm_sec, bold_color, reset_color); printf("%s[%s%7s%s]%s ", bold_color, header_color, header_title, white_color, reset_color); vprintf(format, args); va_end(args); printf("%s/n", reset_color); fflush(stdout);}
开发者ID:iamaeternus,项目名称:monkey,代码行数:65,
示例30: VG_UInt VG_(message)(VgMsgKind kind, const HChar* format, ...){ UInt ret; va_list vargs; va_start(vargs, format); ret = vprintf(format, vargs); va_end(vargs); printf("/n"); return ret; }
开发者ID:ACSOP,项目名称:android_external_valgrind,代码行数:2,
注:本文中的vprintf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ vprintk函数代码示例 C++ vprDEBUG函数代码示例 |