init ems server code
This commit is contained in:
44
plat/public/src/pub_file.c
Normal file
44
plat/public/src/pub_file.c
Normal file
@@ -0,0 +1,44 @@
|
||||
//////////////////////////////////////////////////
|
||||
//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@*/
|
||||
Reference in New Issue
Block a user