minor more sensible handling of strings (pointed out by BMW)

This commit is contained in:
nemu
2009-07-09 20:06:07 +00:00
parent 6e596915c8
commit 97618c5ce4

View File

@ -127,7 +127,7 @@ PMsrHandler::~PMsrHandler()
int PMsrHandler::ReadMsrFile() int PMsrHandler::ReadMsrFile()
{ {
ifstream f; ifstream f;
char str[8192]; string str;
TString line; TString line;
int line_no = 0; int line_no = 0;
int result = PMUSR_SUCCESS; int result = PMUSR_SUCCESS;
@ -158,8 +158,8 @@ int PMsrHandler::ReadMsrFile()
while (!f.eof()) { while (!f.eof()) {
// read a line // read a line
f.getline(str, sizeof(str)); getline(f, str);
line = str; line = str.c_str();
line_no++; line_no++;
current.fLineNo = line_no; current.fLineNo = line_no;
@ -324,7 +324,7 @@ int PMsrHandler::WriteMsrLogFile(const bool messages)
int tag, lineNo = 0, number; int tag, lineNo = 0, number;
int runNo = -1, addRunNo = 0; int runNo = -1, addRunNo = 0;
int plotNo = -1; int plotNo = -1;
char line[8192]; string line;
TString str, sstr; TString str, sstr;
TObjArray *tokens; TObjArray *tokens;
TObjString *ostr; TObjString *ostr;
@ -366,8 +366,8 @@ int PMsrHandler::WriteMsrLogFile(const bool messages)
while (!fin.eof()) { while (!fin.eof()) {
// read a line // read a line
fin.getline(line, sizeof(line)); getline(fin, line);
str = line; str = line.c_str();
lineNo++; lineNo++;
// check for tag // check for tag