I wrote a short function to produce a format string for sscanf while reading some ascii files into ROOT. It will load perfectly fine with either cint or ACLiC. The code below will enter the while loop, but will only execute the loop twice. On the third time through it will crash ROOT and dump core. It runs without complain when compiled in gcc. Any suggestions?
[code]#include
#include
using namespace std;
//*******************************************************************
// Produces a format string for sscanf()
//*******************************************************************
const char* linef(int numave)
{
string line_f, temp;
line_f = “%f”;
int y;
y = 2;
while(y <= numave+5)
{
line_f = line_f + " %*f";
++y;
}
line_f = line_f + " %f";
return line_f.c_str();
}[/code]