Trouble with unbounded sequence
Igor Cunko
Igor.Cunko@open.hr
Tue, 30 Dec 1997 08:57:06 GMT
I have trouble with following code
//IDL
long stockList(inout StockSeq s);
//code=20
CORBA::Long Broker_i::stockList (StockSeq &seq)
{
ifstream fin("\\market\\stocks.txt");
char str[255];
CORBA::ULong len =3D 1L;
seq.length(len);
CORBA::ULong i =3D 0;
while ( !fin.eof() && (i < 3))
{
fin.getline(str,255);
seq[i].Name =3D (const char*)str;
fin >> seq[i].Value;
fin >> seq[i].Amount;
fin.getline(str,255);
i++;
seq.length(len++);
}
fin.close();
return (CORBA::Long)seq.length();
}
It generates system exception. It happens when I increase sequence length=
in
loop (maybe too fast). Is this proper behavior and if it is how can I =
avoid
this?If I slow down loop (e.g. add little wait ) it works OK.
--------------------------------------------------------------
"When I die, I want to go peacefully in my sleep - like my=20
grandfather - not screaming like the passengers in his car."