I have the error:
error C2039: ‘read’ : is not a member of ‘`global namespace”
and
error C2661: ‘Calc::SymString::read’ : no overloaded function takes 3 arguments
from the line:
if (::read(fd_sock, &size, 4) != 4)
This error and similar ones appear quite a lot in my code. Does anyone know what the problem could be?
I am using Windows Visual Studio 2010 and I am migrating code from Unix.
Thanks in advance!
read() is a UNIX function defined (in LINUX) in unistd.h – all the documentation I have read indicates it is not a standard C function. That may be why it is compiling in UNIX but not in Windows.
In UNIX
read()takes a file descriptor, but the equivalent construct in Windows is a “handle”.Do you really need low level file descriptor I/O in your program? Can you use
fread, which is a standard C function?This Microsoft support article describes the types of file handles available in Windows: