开发者

c++ file descriptor (sockets) isopen()?

开发者 https://www.devze.com 2023-02-25 12:25 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消