I am trying to port some C which uses read() and write() functions for sending sockets. I am trying to port this to windows and it is suggested (from what I have read) to use WriteFile and ReadFile to accomplish my task.
I read according to Microsoft API documentation that WriteFile will accept a socket. But I am unsure why its not working
(Beginner C Coder)
SOCKET sock;
I set sock to a socket type
WriteFile((HANDLE *)sock, data, 17, NULL, NULL);
Now I know I am doing some thing wrong with that (HANDLE *) type cast but I get an error saying that “int cast to pointer with out a type cast” if I don’t (or something similar).
So my question is how can I send a socket using WriteFile as well as read a socket using ReadFile
*cheers
ty
WriteFilewants a handle, not a pointer to a handle. You probably want to use: