Quantcast
Channel: CSDN博客推荐文章
Viewing all articles
Browse latest Browse all 35570

写日志 可变参数

$
0
0
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <stdlib.h>
#include <stdarg.h>
using namespace std;

int logfile(const char * format, ...)
{
    FILE *logfile;
    logfile=fopen("1.txt","a+");
    va_list arg_ptr;
    va_start(arg_ptr, format);
    int nWrittenBytes = vfprintf(logfile, format, arg_ptr);
    va_end(arg_ptr);
    return nWrittenBytes;
}
int main()
{
    logfile("%s logged out.","124");
}

作者:qiqijianglu 发表于2013-8-1 16:38:18 原文链接
阅读:40 评论:0 查看评论

Viewing all articles
Browse latest Browse all 35570

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>