On 16 Cze, 21:08, Robert Bauck Hamar <roberth+n...@ifi.uio.nowrote:
It's hard to guess without seeing any code.
class object
{
public:
int p[2];
object(int id)
{
pipe(p);
printf("Object %d has descriptor %d.",id,p[0]);
}
~object()
{
close(p[0]);
close(p[1]);
}
};
Static array of those will return eg.
object objects[3];
Object 1 has descriptor 7.
Object 2 has descriptor 9.
Object 3 has descriptor 11. (there are pairs of them of
c.)
STL vector will return:
vector<objectobjects;
objects.push_back(1);objects.push_back(2);objects. push_back(3);
Object 1 has descriptor 7.
Object 2 has descriptor 7.
Object 3 has descriptor 7.
Which is totally not what I want. What's more if there was a socket
descriptor no.7 before, I may get same pipe descriptor AND socket
descriptor at the same time, which is so wrong.
Ask whatever you need.
Marcin