c2v
c2v copied to clipboard
Failed to Properly Format Select Statement
if select(
(int(tcp_socket.socket)) + 1 &fd_read &fd_write &fd_errors &tv) == -1 {
status.error_state = RmtError.rmt_error_socket_select_fail
return status
}
Here's the original V code, I forgot the error, but it's a problem with the arguments. I'm just not sure how to rewrite it, but I should be able to figure it out. I'll jump on Discord if I can't get past it. I believe the C code is below.
static SocketStatus TCPSocket_PollStatus(TCPSocket* tcp_socket)
{
SocketStatus status;
fd_set fd_read, fd_write, fd_errors;
struct timeval tv;
status.can_read = RMT_FALSE;
status.can_write = RMT_FALSE;
status.error_state = RMT_ERROR_NONE;
assert(tcp_socket != NULL);
if (tcp_socket->socket == INVALID_SOCKET)
{
status.error_state = RMT_ERROR_SOCKET_INVALID_POLL;
return status;
}
Can you provide a link to the full code of the lib you are trying to translate?
Sorry about that, I'll remember to post it next time. https://github.com/topcheese/v-remotery/blob/main/lib/Remotery.c