45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
//////////////////////////////////////////////////
|
|
//Title : wxc_file.c
|
|
//Auhtor : Liu Wei
|
|
//Desc : wxc file handle inplementation
|
|
//Created : 2007-06-04
|
|
//Revision :
|
|
//
|
|
//Revision :
|
|
//
|
|
//////////////////////////////////////////////////
|
|
|
|
#include "./include/pub_file.h"
|
|
|
|
/*@ignore@*/
|
|
|
|
///////////////////////////////////////////////////////////////////////////
|
|
// GetOneLine: Read one line of a file
|
|
///////////////////////////////////////////////////////////////////////////
|
|
|
|
extern char *GetOneLine ( char *pFileName )
|
|
{
|
|
FILE *pFile;
|
|
static char sBuff[1024];
|
|
char *pCh;
|
|
|
|
pFile = fopen ( pFileName, "r" );
|
|
if ( pFile != NULL )
|
|
{
|
|
if ( fgets ( sBuff, sizeof ( sBuff ), pFile ) != NULL )
|
|
{
|
|
if ( NULL != (pCh = strchr ( sBuff, '\n' )) )
|
|
{
|
|
*pCh = CNULL;
|
|
}
|
|
return sBuff;
|
|
}
|
|
( void ) fclose ( pFile );
|
|
}
|
|
|
|
return ( char * ) NULL;
|
|
}
|
|
|
|
|
|
/*@end@*/
|