HANDLE类似于Linux中的文件描述符吗? [英] Is HANDLE similar to file descriptor in Linux?

查看:984
本文介绍了HANDLE类似于Linux中的文件描述符吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HANDLE类似于Linux中的文件描述符吗?据我所知,HANDLE用于处理Windows上的每个资源,如字体,图标,文件,设备...,这本质上只是一个void指针指向保存特定资源的数据的内存块。 p>

Is HANDLE similar to file descriptor in Linux? As far as I know, HANDLE is used for handling every resources on Windows, such as font, icons, files, devices..., which in essence is just a void pointer point to a memory block holding data of a specific resource

推荐答案

是的,Windows句柄非常类似于Unix文件描述符(FD)。

Yes, Windows handles are very similar to Unix file descriptors (FDs).

请注意, HANDLE 不是指向内存块的指针。虽然 HANDLE typedef 'd为 void * 只是使它更不透明。在实践中, HANDLE 是在表中查找的索引,就像FD编号一样。

Note that a HANDLE is not a pointer to a block of memory. Although HANDLE is typedef'd as void *, that's just to make it more opaque. In practice, a HANDLE is an index that is looked up in a table, just as an FD number is.

本博文探讨了一些相似之处和区别:
http: //lackingrhoticity.blogspot.com/2015/05/passing-fds-handles-between-processes.html

This blog post explores some of the similarities and differences: http://lackingrhoticity.blogspot.com/2015/05/passing-fds-handles-between-processes.html

这篇关于HANDLE类似于Linux中的文件描述符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆