[英]write function requires unistd.h on Unix, what about windows?
I've changed from a linux computer to a windows and I'm having trouble compiling my code because these two OS don't share the same header files. 我已经从Linux计算机更改为Windows并且我在编译代码时遇到问题,因为这两个操作系统不共享相同的头文件。
Since the unistd.h is not obviously included, Visual C doesn't know what read()
, write()
, close()
, socklen_t()
and bzero()
functions are. 由于unistd.h显然不包含在内,因此Visual C不知道read()
, write()
, close()
, socklen_t()
和bzero()
函数是什么。 Can anyone help me with this? 谁能帮我这个?
I've googled this: Is there a replacement for unistd.h for Windows (Visual C)? 我用Google搜索了这个内容: 是否有替换unistd.h for Windows(Visual C)?
I have no idea how unistd.h works, nor do I know how to code my own. 我不知道unistd.h是如何工作的,也不知道如何编写自己的代码。 Can someone please link me to one? 有人可以把我链接到一个吗?
read
, write
and close
are in <io.h>
, just like they traditionally were on Unix. read
, write
和close
都在<io.h>
,就像它们传统上在Unix上一样。
Offhand, I don't know of a bzero
being included on Windows at all -- if you care at all about portability, you normally want to use memset
instead. 另外,我根本不知道Windows中包含的bzero
- 如果你完全关心可移植性,你通常想要使用memset
。
socklen_t
isn't normally used on Windows -- most things that would be socklen_t
on Unix use either size_t
or int
on Windows ( socklen_t
on Unix is currently another reference to the same underlying type as size_t
, added in case it might be useful someday -- aka, a solution in search of a problem). socklen_t
通常不在Windows上使用 - 大多数在Unix上使用socklen_t
东西在Windows上使用size_t
或int
(Unix上的socklen_t
目前是另一个与size_t
相同的底层类型的引用,如果有一天它可能有用的话 - - 又称,寻找问题的解决方案)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.