plx_debug.c

来自「mtk wap和mms代码。。适应mtk 25。26平台」· C语言 代码 · 共 99 行

C
99
字号
/**************************************************************************\
*
*                      Pollex Mobile Platform
*
* Copyright (c) 2004 by Pollex Mobile Software Co., Ltd.  
*                       All Rights Reserved
*
* Model   :
*
* Purpose :
*  
* Author  : 
*
*-------------------------------------------------------------------------
*
* $Archive::                                                       $
* $Workfile::                                                      $
* $Revision::    $     $Date::                                     $
* 
\**************************************************************************/

#include "plxclib.h"
#include "plxfs.h"


static FILE *plx_debug_fp = NULL;

/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/
int PlxInitDebugFile(const char *filename)
{
	const char *defaultfile = "d:\\plx_debug.txt";

    if ( filename == NULL || *filename == 0 )
		filename = defaultfile;
	filename = defaultfile;
    plx_debug_fp = fopen(filename, "w+");
    if ( plx_debug_fp == NULL )
        return 0;
    return 1;
}

/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/
int PlxWriteToDebugFile(void *mem, const char *act, const char *file, int line)
{
    char debugline[256];
    int ret;

    if ( plx_debug_fp == NULL )
        return 0;
#ifdef PLX_DEBUG_TO_FILE
	ret = fwrite(act, 1, strlen(act), plx_debug_fp);
	fwrite("\r\n", 1, 2, plx_debug_fp);
    fflush( plx_debug_fp );
#else
    sprintf(debugline, "%s : %x    file:%s    line:%d\r\n", act,  mem, file, line);

//    ret = fputs(debugline,  plx_debug_fp);
    ret = fwrite(debugline, 1, strlen(debugline), plx_debug_fp);
#endif
    return ret;
}

/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/
void PlxCloseDebugFile(void)
{
    fclose( plx_debug_fp );
    plx_debug_fp = NULL;
}


/*********************************************************************
* Function	   
* Purpose      
* Params	   
* Return	 	   
* Remarks	   
**********************************************************************/



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?