#include<stdio.h>

#include <stdarg.h>

#include <unistd.h>

#include <stdint.h>

#include <stdarg.h>

#include <fcntl.h>

#include <time.h>

int vAppLogPrintf( uint8_t *buff, uint32_t len )
{ int f_log; f_log = open( "log.txt", O_CREAT|O_RDWR, ); if( f_log < )
{
return -;
} //将文件写入指针 移动到文件结尾
lseek( f_log, , SEEK_END ); //将消息缓冲区 写入到文件
write( f_log, buff, len ); close( f_log ); return ; } int appLogPrintf(const char *fmt, ...)
{
va_list args;
int r,printed_len;
static char printk_buf[]; va_start(args, fmt);
/* Emit the output into the temporary buffer */
printed_len = vsnprintf(printk_buf, sizeof(printk_buf), fmt, args);
va_end(args); return vAppLogPrintf( printk_buf, printed_len ); } int main( int argc, char **argv )
{
time_t systemTimeNow; for( ;; )
{ systemTimeNow = time( NULL );/* 获取当前系统时间 */ appLogPrintf( "hello,world,%s\n", ctime( &systemTimeNow ) ); printf( "hello,world,%s\n", ctime( &systemTimeNow ) ); sleep( );
}
}

树莓派 log 日志 打印到 TXT的更多相关文章

  1. android的Log日志打印管理工具类(一)

    android的Log日志的打印管理工具类: package com.gzcivil.utils; import android.util.Log; /** * 日志打印管理 * * @author ...

  2. 超高逼格Log日志打印

    代码地址如下:http://www.demodashi.com/demo/12646.html 前言 Log日志的打印一直是一个比较头疼的事,怎样才能让自己的log显示更多信息,怎样才能让自己的log ...

  3. Java编码常见的Log日志打印问题

    前言 本文总结了作者在Java代码检视中遇到的一些关于日志打印的问题,并给出修改建议.因能力有限,难免存在错漏,欢迎指正. 一. 不规范的异常打印 使用slf4j日志组件时,logger.error( ...

  4. Javascript 将 console.log 日志打印到 html 页面中

    如何将 console.log() 打印的日志输出到 html 页面中 (function () { var old = console.log; var logger = document.getE ...

  5. Junit测试打印详细的log日志,可以看到sql

    Junit测试打印详细的log日志,可以看到sql 在log4j.xml的日志配置文件中,把日志级别从info级别调整到debug级别: <?xml version="1.0" ...

  6. log日志中不打印异常栈的具体信息

    问题与分析 最近在查项目的log时发现报了大量的NPE(NullPointerException),诡异的是只log了Exception的类名,却没有具体的堆栈信息,以致于无法对该NPE异常进行准确定 ...

  7. rest-assured 将log()中的信息打印到log日志中去的方法

    rest-assured 将log()中的信息打印到log日志中去的方法: ============方法1============== PrintStream fileOutPutStream = n ...

  8. android 华为、魅族手机无法打印 Log 日志的问题

    最近使用魅族真机测试 App 时,发现 LogCat 不显示项目工程中通过Log.d()和Log.v()打印的 debug 和 verbose 级别的日志,甚是奇怪,通过 debug 模式断点调试也没 ...

  9. Xposed框架Hook Android应用的所有类方法打印Log日志

    本文博客地址:https://blog.csdn.net/QQ1084283172/article/details/80954759 在进行Android程序的逆向分析的时候,经常需要Android程 ...

随机推荐

  1. AIX修改时区,配置NTP服务

    AIX修改时区 smitty --> System Environments -->Change/Show Data and Time -->Change Time Zone Usi ...

  2. Android自带语音播报+讯飞语音播报封装(直接用)

    一.Android自带的语音播报 1.查看是否支持中文,在测试的设备中打开‘设置’ -->找到 '语言和输入法'-->查看语音选项,是否支持中文,默认仅支持英文. 使用如下: public ...

  3. linux 用户配置文件及其相关目录

    用户配置文件及其相关目录: /etc/passwd 用户信息文件/etc/shadow 影子文件/etc/group 组信息文件/etc/gshadow 组密码文件邮箱目录模板目录 /etc/pass ...

  4. oracle常见的等待事件说明

    转自 http://blog.itpub.net/29371470/viewspace-1063994/ 1. Buffer busy waits 从本质上讲,这个等待事件的产生仅说明了一个会话在等待 ...

  5. 【转】教你弄清 OSX 的睡眠模式,以及合法的禁止产生 sleepimage

    原文链接 因为之前用的是网上流传的土法来禁止生成 sleepimage,尝到了苦头,而且2次! 大家知道 OSX 有几种睡眠模式,其中 hibernatemode 可以是 0 (传统睡眠方式,不生成 ...

  6. C语言高精度乘法

    #include <stdio.h> void highPrecision (int N ); ] = {, }, length = ; //开辟一个大的数组,全局变量length记录长度 ...

  7. 使用keychain永久存储数据

    使用keychain永久存储数据 https://github.com/soffes/sskeychain keychain当然还是使用开源的好:),keychain是干啥用的?这个,baidu一下你 ...

  8. @private、@protected与@public三者之间的区别

    @private.@protected与@public三者之间的区别 类之间关系图 @private只能够使用在声明的类当中,其子类也不能够使用用@private声明的实例变量 @protected只 ...

  9. LinkedHashSet 元素唯一,存储取出有序

      package cn.itcast_04; import java.util.LinkedHashSet; /* * LinkedHashSet:底层数据结构由哈希表和链表组成. * 哈希表保证元 ...

  10. 安装zabbix3.4的过程(一)

    目录 zabbix服务端安装(centos7.4) zabbix客户端安装 (centos6.9) 注释:本次安装为官方推荐的yum安装方式,如果需要编译安装,请查看下边的博文: 博文地址:https ...