c++ file descriptor (sockets) isopen()?
In C++, is there a way to check if a file开发者_StackOverflow社区 descriptor is still open, long after it was initially opened?
You can use fcntl with the F_GETFL to get if the fd is valid or not.
fstat
is the most portable way I can think of.
If you tell us what platform, we may be able to suggest something better for your particular situation.
精彩评论