Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

utils.cc File Reference

#include <string.h>
#include <omnetpp.h>
#include "utils.h"

Go to the source code of this file.

Functions

char * fgetline (FILE *fp)


Function Documentation

char* fgetline FILE *    fp
 

Definition at line 23 of file utils.cc.

References MAX_LINE.

Referenced by MACRelayUnitBase::readAddressTable().

00024 {
00025     // alloc buffer and read a line
00026     char *line = new char[MAX_LINE];
00027     if (fgets(line,MAX_LINE,fp)==NULL)
00028         return NULL;
00029 
00030     // chop CR/LF
00031     line[MAX_LINE-1] = '\0';
00032     int len = strlen(line);
00033     while (len>0 && (line[len-1]=='\n' || line[len-1]=='\r'))
00034         line[--len]='\0';
00035 
00036     return line;
00037 }


Generated on Sat May 15 20:30:44 2004 for Ethernet by doxygen1.2.17