Unix to Windows Porting Dictionary for HPC

RSS

Links

Function List

read


Unix

header file: unistd.h

ssize_t read(int fd, void *buffer, size_t count);

Windows

header file: stdio.h

int _read(int fd, void *buffer, unsigned int count);

Purpose

This function reads data from a given file.

Discussion

The Windows and Unix versions of this function differ only in name and the type of the return value; when porting, the easiest way of dealing with dealing with the lack of an ssize_t type in Windows is to either cast it as an int, or simply define it as an int directly (with "#define ssize_t int" or similar).

Example of Use in Windows

For a complete example, please see the MSDN article.

blog comments powered by Disqus
Valid HTML 4.01 Transitional Valid CSS!